Population rate ---> The human population explosion not only affects humans but also our environment and wildlife.As more population requires more resources, deforestation is happening at a faster rate which takes away the homes of these animals. Similarly, their habitat is being destroyed owing to human activities.the increased need calls for faster rates of industrialization. These industries pollute our water and lands, harming and degrading our quality of life.
Crime Rate ---> Murder is the unlawful killing of another human without justification or valid excuse, especially the unlawful killing of another human with malice aforethought. , In this file we will explore the murder rate in the whole world .. To calculate the Murder ratio we have to divide the murder rate on the country population ...
GDP Growth Rate ---> Economics is a social science devoted to the study of how people and societies get what they need and want. In this file , We will explore the world economic growth since 1990 till 2016 ...
Unemployemnt rate ---->Unemployment is a very serious issue not only in India but in the whole world. There are hundreds and thousands of people out there who do not have employment.It will lead to an increase in poverty, an increase in crime rate, exploitation of labor, political instability, mental health, and loss of skills. As a result, all this will eventually lead to the demise of the nation.
income rate for per person ---> For individuals and businesses, income generally means the value or amount that they receive for their labor and products.Individuals generally consider their gross income to equal the total of their earnings in the form of wages and salaries, the return on their investments and sales of property, and other receipts. Their net income is composed of their gross income reduced by costs incurred in producing the income.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import plotly.express as px
import plotly.graph_objects as go
import seaborn as sns
sns.set()
%matplotlib notebook
df_GDP = pd.read_csv("Project2/GDP_growth_rate.csv")
df_Murder = pd.read_csv("Project2/murder_total_deaths.csv")
df_Population = pd.read_csv("Project2/population_total.csv")
df_Income = pd.read_csv("Project2/income_per_person_gdppercapita_ppp_inflation_adjusted.csv")
df_Unemployment = pd.read_csv("Project2/Unemployment_rate.csv")
df_GDP.head()
| Country | 1960 | 1961 | 1962 | 1963 | 1964 | 1965 | 1966 | 1967 | 1968 | ... | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Aruba | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 3.446055 | -1.369863 | 4.198232 | 0.300000 | 5.700001 | 2.100000 | 1.999999 | NaN | NaN | NaN |
| 1 | Africa Eastern and Southern | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 4.014183 | 1.972652 | 4.308370 | 3.986754 | 2.925591 | 2.019391 | 2.542298 | 2.475272 | 2.077898 | -2.939186 |
| 2 | Afghanistan | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 0.426355 | 12.752287 | 5.600745 | 2.724543 | 1.451315 | 2.260314 | 2.647003 | 1.189228 | 3.911603 | -2.351101 |
| 3 | Africa Western and Central | NaN | 1.848719 | 3.770212 | 7.272501 | 5.396356 | 4.049794 | -1.787094 | -9.546521 | 1.465741 | ... | 4.848351 | 5.142964 | 6.104241 | 5.927350 | 2.745937 | 0.127595 | 2.318042 | 2.952230 | 3.190336 | -0.884981 |
| 4 | Angola | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 3.471976 | 8.542188 | 4.954545 | 4.822628 | 0.943572 | -2.580050 | -0.147213 | -2.003630 | -0.624644 | -5.399987 |
5 rows × 62 columns
df_Murder.head()
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 2070 | 2200 | 2380 | 2600 | 2830 | 3020 | 3160 | 3270 | 3350 | ... | 4910 | 4960 | 4990 | 4940 | 5020 | 5190 | 5560 | 5820 | 6060 | 6270 |
| 1 | Angola | 527 | 532 | 543 | 569 | 598 | 608 | 582 | 582 | 667 | ... | 904 | 933 | 958 | 978 | 990 | 1010 | 1030 | 1050 | 1080 | 1090 |
| 2 | Albania | 160 | 182 | 201 | 221 | 239 | 267 | 295 | 327 | 338 | ... | 82.7 | 77.5 | 67.5 | 68.4 | 68.5 | 68.5 | 68.7 | 68.9 | 69.2 | 69.5 |
| 3 | Andorra | 0.48 | 0.51 | 0.54 | 0.55 | 0.55 | 0.53 | 0.51 | 0.5 | 0.49 | ... | 0.52 | 0.52 | 0.53 | 0.54 | 0.54 | 0.54 | 0.55 | 0.55 | 0.55 | 0.55 |
| 4 | United Arab Emirates | 31.4 | 31.6 | 32.2 | 33.2 | 34.4 | 35.8 | 37.1 | 38.5 | 40.2 | ... | 81.7 | 94.9 | 109 | 122 | 129 | 132 | 133 | 133 | 133 | 132 |
5 rows × 28 columns
df_Population.head()
| country | 1800 | 1801 | 1802 | 1803 | 1804 | 1805 | 1806 | 1807 | 1808 | ... | 2091 | 2092 | 2093 | 2094 | 2095 | 2096 | 2097 | 2098 | 2099 | 2100 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 3.28M | 3.28M | 3.28M | 3.28M | 3.28M | 3.28M | 3.28M | 3.28M | 3.28M | ... | 76.6M | 76.4M | 76.3M | 76.1M | 76M | 75.8M | 75.6M | 75.4M | 75.2M | 74.9M |
| 1 | Angola | 1.57M | 1.57M | 1.57M | 1.57M | 1.57M | 1.57M | 1.57M | 1.57M | 1.57M | ... | 168M | 170M | 172M | 175M | 177M | 179M | 182M | 184M | 186M | 188M |
| 2 | Albania | 400k | 402k | 404k | 405k | 407k | 409k | 411k | 413k | 414k | ... | 1.33M | 1.3M | 1.27M | 1.25M | 1.22M | 1.19M | 1.17M | 1.14M | 1.11M | 1.09M |
| 3 | Andorra | 2650 | 2650 | 2650 | 2650 | 2650 | 2650 | 2650 | 2650 | 2650 | ... | 63k | 62.9k | 62.9k | 62.8k | 62.7k | 62.7k | 62.6k | 62.5k | 62.5k | 62.4k |
| 4 | United Arab Emirates | 40.2k | 40.2k | 40.2k | 40.2k | 40.2k | 40.2k | 40.2k | 40.2k | 40.2k | ... | 12.3M | 12.4M | 12.5M | 12.5M | 12.6M | 12.7M | 12.7M | 12.8M | 12.8M | 12.9M |
5 rows × 302 columns
df_Income.head()
| country | 1800 | 1801 | 1802 | 1803 | 1804 | 1805 | 1806 | 1807 | 1808 | ... | 2041 | 2042 | 2043 | 2044 | 2045 | 2046 | 2047 | 2048 | 2049 | 2050 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 674 | 674 | 674 | 674 | 674 | 674 | 674 | 674 | 674 | ... | 2880 | 2940 | 3000 | 3070 | 3130 | 3200 | 3270 | 3340 | 3410 | 3480 |
| 1 | Angola | 691 | 693 | 697 | 700 | 702 | 705 | 709 | 712 | 716 | ... | 8040 | 8220 | 8390 | 8570 | 8750 | 8940 | 9120 | 9320 | 9520 | 9720 |
| 2 | Albania | 746 | 746 | 746 | 746 | 746 | 747 | 747 | 747 | 747 | ... | 24.5k | 25k | 25.5k | 26.1k | 26.6k | 27.2k | 27.8k | 28.3k | 28.9k | 29.6k |
| 3 | Andorra | 1340 | 1340 | 1340 | 1350 | 1350 | 1350 | 1350 | 1360 | 1360 | ... | 108k | 111k | 113k | 116k | 118k | 121k | 123k | 126k | 128k | 131k |
| 4 | United Arab Emirates | 1120 | 1120 | 1120 | 1130 | 1130 | 1140 | 1140 | 1150 | 1150 | ... | 74.5k | 76.1k | 77.7k | 79.3k | 81k | 82.7k | 84.5k | 86.3k | 88.1k | 90k |
5 rows × 252 columns
df_Unemployment.head()
| Country | 1960 | 1961 | 1962 | 1963 | 1964 | 1965 | 1966 | 1967 | 1968 | ... | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Aruba | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 1 | Africa Eastern and Southern | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 6.748081 | 6.562179 | 6.445456 | 6.405195 | 6.490041 | 6.610205 | 6.714955 | 6.731163 | 6.914353 | 7.563187 |
| 2 | Afghanistan | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 11.054000 | 11.341000 | 11.193000 | 11.142000 | 11.127000 | 11.158000 | 11.180000 | 11.152000 | 11.217000 | 11.710000 |
| 3 | Africa Western and Central | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 4.548376 | 4.637602 | 4.410216 | 4.688088 | 4.626737 | 5.567017 | 6.019505 | 6.041092 | 6.063362 | 6.774914 |
| 4 | Angola | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | 7.360000 | 7.347000 | 7.366000 | 7.372000 | 7.392000 | 7.412000 | 7.408000 | 7.421000 | 7.421000 | 8.333000 |
5 rows × 62 columns
def replacing(df):
#First i replaced all K, M , B with empty space , Then i extracted all the K, M , B to its amount in numbers and multiply it in the number that had them..
for values in df.columns[1:]:
df[values] = df[values].replace(r'[kMB]+$', '', regex=True).astype(float) * df[values].str.extract(r'[\d\.]+([kMB]+)', expand=False).fillna(1).replace(['k','M',"B"], [10**3, 10**6, 10**9]).astype(int)
return df
years = df_Income.columns[df_Income.columns.get_loc("1990"):df_Income.columns.get_loc("2016")+1]
def filtering_years(df):
for year in df.columns:
if year not in years and year not in ["country", "Country"]:
df.drop(year, axis=1, inplace=True)
return df
ye2 = [2000 , 2005 , 2010 , 2016]
def Comparing(df):
new_df = df[(df.index == "2000") | (df.index == "2005") | (df.index == "2010") | (df.index == "2016")]
return new_df
sum(df_Population.isnull().sum())
0
sum(df_Income.isnull().sum())
0
sum(df_Murder.isnull().sum())
0
sum(df_GDP.isnull().sum())
4073
sum(df_Unemployment.isnull().sum())
9176
df_GDP.fillna(0,inplace=True)
df_Unemployment.fillna(0, inplace=True)
sum(df_GDP.isnull().sum())
0
sum(df_Unemployment.isnull().sum())
0
filtering_years(df_GDP)
| Country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Aruba | 3.961402 | 7.962872 | 5.882353 | 7.307692 | 8.203903 | 2.547144 | 1.185788 | 7.046874 | 1.991986 | ... | 1.800226 | -0.090708 | -10.519749 | -3.685029 | 3.446055 | -1.369863 | 4.198232 | 0.300000 | 5.700001 | 2.100000 |
| 1 | Africa Eastern and Southern | 0.050826 | -0.095421 | -2.343192 | -1.089417 | 2.051914 | 4.409975 | 5.570030 | 3.425412 | 1.789507 | ... | 6.857304 | 4.572539 | 0.946811 | 5.152336 | 4.014183 | 1.972652 | 4.308370 | 3.986754 | 2.925591 | 2.019391 |
| 2 | Afghanistan | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | ... | 13.826320 | 3.924984 | 21.390528 | 14.362441 | 0.426355 | 12.752287 | 5.600745 | 2.724543 | 1.451315 | 2.260314 |
| 3 | Africa Western and Central | 6.562921 | 1.121069 | 2.693959 | -1.160468 | -0.299641 | 1.927028 | 4.629048 | 4.234699 | 3.506516 | ... | 5.530987 | 6.279223 | 6.274463 | 6.957010 | 4.848351 | 5.142964 | 6.104241 | 5.927350 | 2.745937 | 0.127595 |
| 4 | Angola | -3.450099 | 0.991359 | -5.838281 | -23.983417 | 1.339363 | 15.000000 | 13.544370 | 7.274277 | 4.691146 | ... | 14.010018 | 11.166138 | 0.858713 | 4.403933 | 3.471976 | 8.542188 | 4.954545 | 4.822628 | 0.943572 | -2.580050 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 261 | Kosovo | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | ... | 0.000000 | 0.000000 | 5.034884 | 4.939924 | 6.319886 | 1.712195 | 5.340908 | 3.348804 | 5.916270 | 5.571757 |
| 262 | Yemen, Rep. | 0.000000 | 6.293494 | 8.207598 | 4.001966 | 6.721949 | 5.669371 | 4.634967 | 5.231112 | 6.006695 | ... | 3.338428 | 3.647569 | 3.866230 | 7.702307 | -12.714823 | 2.392886 | 4.823415 | -0.188574 | -27.994546 | -9.375124 |
| 263 | South Africa | -0.317786 | -1.018220 | -2.137057 | 1.233520 | 3.200000 | 3.100000 | 4.300000 | 2.600000 | 0.500000 | ... | 5.360474 | 3.191044 | -1.538089 | 3.039733 | 3.168556 | 2.396232 | 2.485468 | 1.413826 | 1.321862 | 0.664552 |
| 264 | Zambia | -0.481072 | -0.036133 | -1.730922 | 6.797274 | -8.625442 | 2.897669 | 6.218546 | 3.814007 | -0.385746 | ... | 8.352436 | 7.773896 | 9.220348 | 10.298223 | 5.564602 | 7.597593 | 5.057232 | 4.697992 | 2.920375 | 3.776679 |
| 265 | Zimbabwe | 6.988553 | 5.531782 | -9.015570 | 1.051459 | 9.235199 | 0.158026 | 10.360697 | 2.680594 | 2.885212 | ... | -3.653327 | -17.668946 | 12.019560 | 19.675323 | 14.193913 | 16.665429 | 1.989493 | 2.376929 | 1.779873 | 0.755869 |
266 rows × 28 columns
filtering_years(df_Unemployment)
| Country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Aruba | 0.0 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | ... | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| 1 | Africa Eastern and Southern | 0.0 | 7.797012 | 7.838142 | 7.849445 | 7.839701 | 7.833286 | 7.841857 | 7.858703 | 7.810903 | ... | 6.738765 | 6.271977 | 6.323909 | 6.867786 | 6.748081 | 6.562179 | 6.445456 | 6.405195 | 6.490041 | 6.610205 |
| 2 | Afghanistan | 0.0 | 10.649000 | 10.821000 | 10.723000 | 10.726000 | 11.179000 | 10.962000 | 10.783000 | 10.802000 | ... | 11.301000 | 11.093000 | 11.311000 | 11.352000 | 11.054000 | 11.341000 | 11.193000 | 11.142000 | 11.127000 | 11.158000 |
| 3 | Africa Western and Central | 0.0 | 4.415455 | 4.530574 | 4.546265 | 4.539152 | 4.525745 | 4.566774 | 4.602367 | 4.662650 | ... | 4.627661 | 4.599393 | 4.583291 | 4.554662 | 4.548376 | 4.637602 | 4.410216 | 4.688088 | 4.626737 | 5.567017 |
| 4 | Angola | 0.0 | 4.208000 | 4.208000 | 4.231000 | 4.162000 | 4.114000 | 4.097000 | 4.088000 | 4.072000 | ... | 3.821000 | 3.793000 | 3.780000 | 9.430000 | 7.360000 | 7.347000 | 7.366000 | 7.372000 | 7.392000 | 7.412000 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 261 | Kosovo | 0.0 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | ... | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| 262 | Yemen, Rep. | 0.0 | 8.318000 | 8.310000 | 8.355000 | 8.340000 | 8.964000 | 9.590000 | 10.201000 | 10.812000 | ... | 12.494000 | 12.621000 | 12.749000 | 12.831000 | 13.235000 | 13.167000 | 13.268000 | 13.470000 | 13.770000 | 13.433000 |
| 263 | South Africa | 0.0 | 29.955000 | 29.980000 | 29.922001 | 29.889000 | 29.893999 | 29.874001 | 29.907000 | 29.947001 | ... | 26.540001 | 22.410000 | 23.520000 | 24.680000 | 24.639999 | 24.730000 | 24.559999 | 24.889999 | 25.150000 | 26.540001 |
| 264 | Zambia | 0.0 | 18.900000 | 19.370001 | 19.700001 | 18.426001 | 16.806000 | 15.300000 | 13.644000 | 12.000000 | ... | 10.587000 | 7.930000 | 10.558000 | 13.190000 | 10.551000 | 7.850000 | 8.611000 | 9.362000 | 10.125000 | 10.872000 |
| 265 | Zimbabwe | 0.0 | 4.941000 | 4.993000 | 4.974000 | 4.960000 | 5.633000 | 6.251000 | 6.930000 | 6.460000 | ... | 4.829000 | 5.014000 | 5.083000 | 5.209000 | 5.370000 | 5.153000 | 4.982000 | 4.770000 | 4.778000 | 4.788000 |
266 rows × 28 columns
filtering_years(df_Population)
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 12.4M | 13.3M | 14.5M | 15.8M | 17.1M | 18.1M | 18.9M | 19.4M | 19.7M | ... | 27.1M | 27.7M | 28.4M | 29.2M | 30.1M | 31.2M | 32.3M | 33.4M | 34.4M | 35.4M |
| 1 | Angola | 11.8M | 12.2M | 12.7M | 13.1M | 13.5M | 13.9M | 14.4M | 14.9M | 15.4M | ... | 20.9M | 21.7M | 22.5M | 23.4M | 24.2M | 25.1M | 26M | 26.9M | 27.9M | 28.8M |
| 2 | Albania | 3.29M | 3.28M | 3.25M | 3.2M | 3.15M | 3.11M | 3.1M | 3.1M | 3.11M | ... | 3.03M | 3M | 2.97M | 2.95M | 2.93M | 2.91M | 2.9M | 2.9M | 2.89M | 2.89M |
| 3 | Andorra | 54.5k | 56.7k | 58.9k | 61k | 62.7k | 63.9k | 64.4k | 64.3k | 64.1k | ... | 82.7k | 83.9k | 84.5k | 84.5k | 83.7k | 82.4k | 80.8k | 79.2k | 78k | 77.3k |
| 4 | United Arab Emirates | 1.83M | 1.94M | 2.05M | 2.17M | 2.29M | 2.42M | 2.54M | 2.67M | 2.81M | ... | 6.17M | 7.09M | 7.92M | 8.55M | 8.95M | 9.14M | 9.2M | 9.21M | 9.26M | 9.36M |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 192 | Samoa | 163k | 164k | 165k | 167k | 169k | 170k | 171k | 172k | 173k | ... | 182k | 183k | 185k | 186k | 187k | 189k | 191k | 192k | 194k | 195k |
| 193 | Yemen | 11.7M | 12.3M | 13M | 13.6M | 14.3M | 14.9M | 15.5M | 16M | 16.5M | ... | 21.3M | 21.9M | 22.5M | 23.2M | 23.8M | 24.5M | 25.1M | 25.8M | 26.5M | 27.2M |
| 194 | South Africa | 36.8M | 37.7M | 38.7M | 39.6M | 40.6M | 41.4M | 42.2M | 43M | 43.7M | ... | 49.1M | 49.8M | 50.5M | 51.2M | 52M | 52.8M | 53.7M | 54.5M | 55.4M | 56.2M |
| 195 | Zambia | 8.04M | 8.25M | 8.45M | 8.66M | 8.87M | 9.1M | 9.34M | 9.6M | 9.87M | ... | 12.5M | 12.8M | 13.2M | 13.6M | 14M | 14.5M | 14.9M | 15.4M | 15.9M | 16.4M |
| 196 | Zimbabwe | 10.4M | 10.7M | 10.9M | 11.1M | 11.3M | 11.4M | 11.5M | 11.7M | 11.7M | ... | 12.3M | 12.4M | 12.5M | 12.7M | 12.9M | 13.1M | 13.4M | 13.6M | 13.8M | 14M |
197 rows × 28 columns
filtering_years(df_Murder)
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 2070 | 2200 | 2380 | 2600 | 2830 | 3020 | 3160 | 3270 | 3350 | ... | 4910 | 4960 | 4990 | 4940 | 5020 | 5190 | 5560 | 5820 | 6060 | 6270 |
| 1 | Angola | 527 | 532 | 543 | 569 | 598 | 608 | 582 | 582 | 667 | ... | 904 | 933 | 958 | 978 | 990 | 1010 | 1030 | 1050 | 1080 | 1090 |
| 2 | Albania | 160 | 182 | 201 | 221 | 239 | 267 | 295 | 327 | 338 | ... | 82.7 | 77.5 | 67.5 | 68.4 | 68.5 | 68.5 | 68.7 | 68.9 | 69.2 | 69.5 |
| 3 | Andorra | 0.48 | 0.51 | 0.54 | 0.55 | 0.55 | 0.53 | 0.51 | 0.5 | 0.49 | ... | 0.52 | 0.52 | 0.53 | 0.54 | 0.54 | 0.54 | 0.55 | 0.55 | 0.55 | 0.55 |
| 4 | United Arab Emirates | 31.4 | 31.6 | 32.2 | 33.2 | 34.4 | 35.8 | 37.1 | 38.5 | 40.2 | ... | 81.7 | 94.9 | 109 | 122 | 129 | 132 | 133 | 133 | 133 | 132 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 189 | Samoa | 7.44 | 7.55 | 7.65 | 7.72 | 7.78 | 7.81 | 7.89 | 7.97 | 8.01 | ... | 7.74 | 7.71 | 7.77 | 7.85 | 7.88 | 7.92 | 7.98 | 8.02 | 8.05 | 8.02 |
| 190 | Yemen | 356 | 373 | 393 | 414 | 433 | 450 | 465 | 479 | 493 | ... | 683 | 706 | 728 | 745 | 766 | 791 | 820 | 844 | 876 | 906 |
| 191 | South Africa | 17.2k | 17.7k | 18.3k | 18.3k | 18.6k | 18.5k | 18.8k | 19.8k | 20.4k | ... | 22.7k | 21.6k | 20.8k | 20.1k | 19.4k | 18.6k | 18.3k | 18.4k | 18.8k | 19.2k |
| 192 | Zambia | 439 | 483 | 526 | 570 | 621 | 679 | 745 | 810 | 885 | ... | 1240 | 1280 | 1300 | 1330 | 1370 | 1380 | 1410 | 1430 | 1460 | 1500 |
| 193 | Zimbabwe | 617 | 564 | 564 | 576 | 607 | 679 | 713 | 787 | 893 | ... | 1320 | 1360 | 1390 | 1410 | 1440 | 1450 | 1490 | 1540 | 1580 | 1650 |
194 rows × 28 columns
filtering_years(df_Income)
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 1110 | 1010 | 971 | 665 | 493 | 728 | 690 | 656 | 627 | ... | 1460 | 1480 | 1760 | 1960 | 1910 | 2080 | 2120 | 2100 | 2070 | 2060 |
| 1 | Angola | 1590 | 1650 | 1600 | 1240 | 1290 | 1520 | 1760 | 1940 | 2080 | ... | 6920 | 7820 | 7750 | 7690 | 7680 | 8040 | 8140 | 8240 | 8040 | 7570 |
| 2 | Albania | 4840 | 3510 | 3280 | 3610 | 3930 | 4490 | 4930 | 4420 | 4840 | ... | 9180 | 9940 | 10.3k | 10.8k | 11.1k | 11.3k | 11.4k | 11.6k | 11.9k | 12.3k |
| 3 | Andorra | 31.8k | 31.3k | 30.4k | 29.1k | 29k | 29.2k | 30.4k | 33.2k | 34.5k | ... | 48.6k | 46.3k | 46.7k | 43.6k | 46.9k | 46.9k | 48.9k | 50.2k | 52.1k | 53.9k |
| 4 | United Arab Emirates | 51.1k | 50.3k | 50.3k | 49.8k | 52.8k | 55.9k | 58.3k | 62.5k | 62.5k | ... | 76.6k | 68.8k | 58.4k | 54.9k | 56.1k | 57.4k | 59.9k | 62.4k | 65.2k | 66.5k |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 190 | Samoa | 4060 | 3940 | 3890 | 4010 | 3870 | 4100 | 4370 | 4370 | 4450 | ... | 6360 | 6380 | 6030 | 6010 | 6210 | 5910 | 5830 | 5790 | 6000 | 6450 |
| 191 | Yemen | 4170 | 4210 | 4320 | 4270 | 4340 | 4400 | 4440 | 4520 | 4650 | ... | 5190 | 5230 | 5280 | 5540 | 4700 | 4690 | 4790 | 4660 | 3270 | 2880 |
| 192 | South Africa | 10.3k | 9940 | 9490 | 9380 | 9450 | 9540 | 9760 | 9840 | 9730 | ... | 12.4k | 12.6k | 12.3k | 12.5k | 12.7k | 12.7k | 12.9k | 12.9k | 12.8k | 12.7k |
| 193 | Zambia | 2190 | 2130 | 2050 | 2130 | 1900 | 1910 | 1980 | 2000 | 1930 | ... | 2620 | 2750 | 2920 | 3130 | 3200 | 3340 | 3400 | 3450 | 3440 | 3470 |
| 194 | Zimbabwe | 3320 | 3430 | 3060 | 3030 | 3260 | 3230 | 3520 | 3580 | 3650 | ... | 2130 | 1740 | 1930 | 2270 | 2560 | 2930 | 2940 | 2960 | 2960 | 2940 |
195 rows × 28 columns
replacing(df_Income)
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 1110.0 | 1010.0 | 971.0 | 665.0 | 493.0 | 728.0 | 690.0 | 656.0 | 627.0 | ... | 1460.0 | 1480.0 | 1760.0 | 1960.0 | 1910.0 | 2080.0 | 2120.0 | 2100.0 | 2070.0 | 2060.0 |
| 1 | Angola | 1590.0 | 1650.0 | 1600.0 | 1240.0 | 1290.0 | 1520.0 | 1760.0 | 1940.0 | 2080.0 | ... | 6920.0 | 7820.0 | 7750.0 | 7690.0 | 7680.0 | 8040.0 | 8140.0 | 8240.0 | 8040.0 | 7570.0 |
| 2 | Albania | 4840.0 | 3510.0 | 3280.0 | 3610.0 | 3930.0 | 4490.0 | 4930.0 | 4420.0 | 4840.0 | ... | 9180.0 | 9940.0 | 10300.0 | 10800.0 | 11100.0 | 11300.0 | 11400.0 | 11600.0 | 11900.0 | 12300.0 |
| 3 | Andorra | 31800.0 | 31300.0 | 30400.0 | 29100.0 | 29000.0 | 29200.0 | 30400.0 | 33200.0 | 34500.0 | ... | 48600.0 | 46300.0 | 46700.0 | 43600.0 | 46900.0 | 46900.0 | 48900.0 | 50200.0 | 52100.0 | 53900.0 |
| 4 | United Arab Emirates | 51100.0 | 50300.0 | 50300.0 | 49800.0 | 52800.0 | 55900.0 | 58300.0 | 62500.0 | 62500.0 | ... | 76600.0 | 68800.0 | 58400.0 | 54900.0 | 56100.0 | 57400.0 | 59900.0 | 62400.0 | 65200.0 | 66500.0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 190 | Samoa | 4060.0 | 3940.0 | 3890.0 | 4010.0 | 3870.0 | 4100.0 | 4370.0 | 4370.0 | 4450.0 | ... | 6360.0 | 6380.0 | 6030.0 | 6010.0 | 6210.0 | 5910.0 | 5830.0 | 5790.0 | 6000.0 | 6450.0 |
| 191 | Yemen | 4170.0 | 4210.0 | 4320.0 | 4270.0 | 4340.0 | 4400.0 | 4440.0 | 4520.0 | 4650.0 | ... | 5190.0 | 5230.0 | 5280.0 | 5540.0 | 4700.0 | 4690.0 | 4790.0 | 4660.0 | 3270.0 | 2880.0 |
| 192 | South Africa | 10300.0 | 9940.0 | 9490.0 | 9380.0 | 9450.0 | 9540.0 | 9760.0 | 9840.0 | 9730.0 | ... | 12400.0 | 12600.0 | 12300.0 | 12500.0 | 12700.0 | 12700.0 | 12900.0 | 12900.0 | 12800.0 | 12700.0 |
| 193 | Zambia | 2190.0 | 2130.0 | 2050.0 | 2130.0 | 1900.0 | 1910.0 | 1980.0 | 2000.0 | 1930.0 | ... | 2620.0 | 2750.0 | 2920.0 | 3130.0 | 3200.0 | 3340.0 | 3400.0 | 3450.0 | 3440.0 | 3470.0 |
| 194 | Zimbabwe | 3320.0 | 3430.0 | 3060.0 | 3030.0 | 3260.0 | 3230.0 | 3520.0 | 3580.0 | 3650.0 | ... | 2130.0 | 1740.0 | 1930.0 | 2270.0 | 2560.0 | 2930.0 | 2940.0 | 2960.0 | 2960.0 | 2940.0 |
195 rows × 28 columns
replacing(df_Murder)
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 2070.00 | 2200.00 | 2380.00 | 2600.00 | 2830.00 | 3020.00 | 3160.00 | 3270.00 | 3350.00 | ... | 4910.00 | 4960.00 | 4990.00 | 4940.00 | 5020.00 | 5190.00 | 5560.00 | 5820.00 | 6060.00 | 6270.00 |
| 1 | Angola | 527.00 | 532.00 | 543.00 | 569.00 | 598.00 | 608.00 | 582.00 | 582.00 | 667.00 | ... | 904.00 | 933.00 | 958.00 | 978.00 | 990.00 | 1010.00 | 1030.00 | 1050.00 | 1080.00 | 1090.00 |
| 2 | Albania | 160.00 | 182.00 | 201.00 | 221.00 | 239.00 | 267.00 | 295.00 | 327.00 | 338.00 | ... | 82.70 | 77.50 | 67.50 | 68.40 | 68.50 | 68.50 | 68.70 | 68.90 | 69.20 | 69.50 |
| 3 | Andorra | 0.48 | 0.51 | 0.54 | 0.55 | 0.55 | 0.53 | 0.51 | 0.50 | 0.49 | ... | 0.52 | 0.52 | 0.53 | 0.54 | 0.54 | 0.54 | 0.55 | 0.55 | 0.55 | 0.55 |
| 4 | United Arab Emirates | 31.40 | 31.60 | 32.20 | 33.20 | 34.40 | 35.80 | 37.10 | 38.50 | 40.20 | ... | 81.70 | 94.90 | 109.00 | 122.00 | 129.00 | 132.00 | 133.00 | 133.00 | 133.00 | 132.00 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 189 | Samoa | 7.44 | 7.55 | 7.65 | 7.72 | 7.78 | 7.81 | 7.89 | 7.97 | 8.01 | ... | 7.74 | 7.71 | 7.77 | 7.85 | 7.88 | 7.92 | 7.98 | 8.02 | 8.05 | 8.02 |
| 190 | Yemen | 356.00 | 373.00 | 393.00 | 414.00 | 433.00 | 450.00 | 465.00 | 479.00 | 493.00 | ... | 683.00 | 706.00 | 728.00 | 745.00 | 766.00 | 791.00 | 820.00 | 844.00 | 876.00 | 906.00 |
| 191 | South Africa | 17200.00 | 17700.00 | 18300.00 | 18300.00 | 18600.00 | 18500.00 | 18800.00 | 19800.00 | 20400.00 | ... | 22700.00 | 21600.00 | 20800.00 | 20100.00 | 19400.00 | 18600.00 | 18300.00 | 18400.00 | 18800.00 | 19200.00 |
| 192 | Zambia | 439.00 | 483.00 | 526.00 | 570.00 | 621.00 | 679.00 | 745.00 | 810.00 | 885.00 | ... | 1240.00 | 1280.00 | 1300.00 | 1330.00 | 1370.00 | 1380.00 | 1410.00 | 1430.00 | 1460.00 | 1500.00 |
| 193 | Zimbabwe | 617.00 | 564.00 | 564.00 | 576.00 | 607.00 | 679.00 | 713.00 | 787.00 | 893.00 | ... | 1320.00 | 1360.00 | 1390.00 | 1410.00 | 1440.00 | 1450.00 | 1490.00 | 1540.00 | 1580.00 | 1650.00 |
194 rows × 28 columns
replacing(df_Population)
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 12400000.0 | 13300000.0 | 14500000.0 | 15800000.0 | 17100000.0 | 18100000.0 | 18900000.0 | 19400000.0 | 19700000.0 | ... | 27100000.0 | 27700000.0 | 28400000.0 | 29200000.0 | 30100000.0 | 31200000.0 | 32300000.0 | 33400000.0 | 34400000.0 | 35400000.0 |
| 1 | Angola | 11800000.0 | 12200000.0 | 12700000.0 | 13100000.0 | 13500000.0 | 13900000.0 | 14400000.0 | 14900000.0 | 15400000.0 | ... | 20900000.0 | 21700000.0 | 22500000.0 | 23400000.0 | 24200000.0 | 25100000.0 | 26000000.0 | 26900000.0 | 27900000.0 | 28800000.0 |
| 2 | Albania | 3290000.0 | 3280000.0 | 3250000.0 | 3200000.0 | 3150000.0 | 3110000.0 | 3100000.0 | 3100000.0 | 3110000.0 | ... | 3030000.0 | 3000000.0 | 2970000.0 | 2950000.0 | 2930000.0 | 2910000.0 | 2900000.0 | 2900000.0 | 2890000.0 | 2890000.0 |
| 3 | Andorra | 54500.0 | 56700.0 | 58900.0 | 61000.0 | 62700.0 | 63900.0 | 64400.0 | 64300.0 | 64100.0 | ... | 82700.0 | 83900.0 | 84500.0 | 84500.0 | 83700.0 | 82400.0 | 80800.0 | 79200.0 | 78000.0 | 77300.0 |
| 4 | United Arab Emirates | 1830000.0 | 1940000.0 | 2050000.0 | 2170000.0 | 2290000.0 | 2420000.0 | 2540000.0 | 2670000.0 | 2810000.0 | ... | 6170000.0 | 7090000.0 | 7920000.0 | 8550000.0 | 8950000.0 | 9140000.0 | 9200000.0 | 9210000.0 | 9260000.0 | 9360000.0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 192 | Samoa | 163000.0 | 164000.0 | 165000.0 | 167000.0 | 169000.0 | 170000.0 | 171000.0 | 172000.0 | 173000.0 | ... | 182000.0 | 183000.0 | 185000.0 | 186000.0 | 187000.0 | 189000.0 | 191000.0 | 192000.0 | 194000.0 | 195000.0 |
| 193 | Yemen | 11700000.0 | 12300000.0 | 13000000.0 | 13600000.0 | 14300000.0 | 14900000.0 | 15500000.0 | 16000000.0 | 16500000.0 | ... | 21300000.0 | 21900000.0 | 22500000.0 | 23200000.0 | 23800000.0 | 24500000.0 | 25100000.0 | 25800000.0 | 26500000.0 | 27200000.0 |
| 194 | South Africa | 36800000.0 | 37700000.0 | 38700000.0 | 39600000.0 | 40600000.0 | 41400000.0 | 42200000.0 | 43000000.0 | 43700000.0 | ... | 49100000.0 | 49800000.0 | 50500000.0 | 51200000.0 | 52000000.0 | 52800000.0 | 53700000.0 | 54500000.0 | 55400000.0 | 56200000.0 |
| 195 | Zambia | 8040000.0 | 8250000.0 | 8450000.0 | 8660000.0 | 8870000.0 | 9100000.0 | 9340000.0 | 9600000.0 | 9870000.0 | ... | 12500000.0 | 12800000.0 | 13200000.0 | 13600000.0 | 14000000.0 | 14500000.0 | 14900000.0 | 15400000.0 | 15900000.0 | 16400000.0 |
| 196 | Zimbabwe | 10400000.0 | 10700000.0 | 10900000.0 | 11100000.0 | 11300000.0 | 11400000.0 | 11500000.0 | 11700000.0 | 11700000.0 | ... | 12300000.0 | 12400000.0 | 12500000.0 | 12700000.0 | 12900000.0 | 13100000.0 | 13400000.0 | 13600000.0 | 13800000.0 | 14000000.0 |
197 rows × 28 columns
murder_ratio = df_Population.join(df_Murder,rsuffix="_Murder")
murder_ratio
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007_Murder | 2008_Murder | 2009_Murder | 2010_Murder | 2011_Murder | 2012_Murder | 2013_Murder | 2014_Murder | 2015_Murder | 2016_Murder | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 12400000.0 | 13300000.0 | 14500000.0 | 15800000.0 | 17100000.0 | 18100000.0 | 18900000.0 | 19400000.0 | 19700000.0 | ... | 4910.00 | 4960.00 | 4990.00 | 4940.00 | 5020.00 | 5190.00 | 5560.00 | 5820.00 | 6060.00 | 6270.00 |
| 1 | Angola | 11800000.0 | 12200000.0 | 12700000.0 | 13100000.0 | 13500000.0 | 13900000.0 | 14400000.0 | 14900000.0 | 15400000.0 | ... | 904.00 | 933.00 | 958.00 | 978.00 | 990.00 | 1010.00 | 1030.00 | 1050.00 | 1080.00 | 1090.00 |
| 2 | Albania | 3290000.0 | 3280000.0 | 3250000.0 | 3200000.0 | 3150000.0 | 3110000.0 | 3100000.0 | 3100000.0 | 3110000.0 | ... | 82.70 | 77.50 | 67.50 | 68.40 | 68.50 | 68.50 | 68.70 | 68.90 | 69.20 | 69.50 |
| 3 | Andorra | 54500.0 | 56700.0 | 58900.0 | 61000.0 | 62700.0 | 63900.0 | 64400.0 | 64300.0 | 64100.0 | ... | 0.52 | 0.52 | 0.53 | 0.54 | 0.54 | 0.54 | 0.55 | 0.55 | 0.55 | 0.55 |
| 4 | United Arab Emirates | 1830000.0 | 1940000.0 | 2050000.0 | 2170000.0 | 2290000.0 | 2420000.0 | 2540000.0 | 2670000.0 | 2810000.0 | ... | 81.70 | 94.90 | 109.00 | 122.00 | 129.00 | 132.00 | 133.00 | 133.00 | 133.00 | 132.00 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 192 | Samoa | 163000.0 | 164000.0 | 165000.0 | 167000.0 | 169000.0 | 170000.0 | 171000.0 | 172000.0 | 173000.0 | ... | 1240.00 | 1280.00 | 1300.00 | 1330.00 | 1370.00 | 1380.00 | 1410.00 | 1430.00 | 1460.00 | 1500.00 |
| 193 | Yemen | 11700000.0 | 12300000.0 | 13000000.0 | 13600000.0 | 14300000.0 | 14900000.0 | 15500000.0 | 16000000.0 | 16500000.0 | ... | 1320.00 | 1360.00 | 1390.00 | 1410.00 | 1440.00 | 1450.00 | 1490.00 | 1540.00 | 1580.00 | 1650.00 |
| 194 | South Africa | 36800000.0 | 37700000.0 | 38700000.0 | 39600000.0 | 40600000.0 | 41400000.0 | 42200000.0 | 43000000.0 | 43700000.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 195 | Zambia | 8040000.0 | 8250000.0 | 8450000.0 | 8660000.0 | 8870000.0 | 9100000.0 | 9340000.0 | 9600000.0 | 9870000.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 196 | Zimbabwe | 10400000.0 | 10700000.0 | 10900000.0 | 11100000.0 | 11300000.0 | 11400000.0 | 11500000.0 | 11700000.0 | 11700000.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
197 rows × 56 columns
# Checking the dimension of the murder ratio data...
murder_ratio.shape
(197, 56)
#Putting the countries in the population data in population variable, and putting the countries in the total murder data to the murder variable ...
population = murder_ratio["country"].sort_values().values
murder = murder_ratio["country_Murder"].sort_values().values
population
array(['Afghanistan', 'Albania', 'Algeria', 'Andorra', 'Angola',
'Antigua and Barbuda', 'Argentina', 'Armenia', 'Australia',
'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh',
'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bhutan',
'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Brazil',
'Brunei', 'Bulgaria', 'Burkina Faso', 'Burundi', 'Cambodia',
'Cameroon', 'Canada', 'Cape Verde', 'Central African Republic',
'Chad', 'Chile', 'China', 'Colombia', 'Comoros',
'Congo, Dem. Rep.', 'Congo, Rep.', 'Costa Rica', "Cote d'Ivoire",
'Croatia', 'Cuba', 'Cyprus', 'Czech Republic', 'Denmark',
'Djibouti', 'Dominica', 'Dominican Republic', 'Ecuador', 'Egypt',
'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia',
'Eswatini', 'Ethiopia', 'Fiji', 'Finland', 'France', 'Gabon',
'Gambia', 'Georgia', 'Germany', 'Ghana', 'Greece', 'Grenada',
'Guatemala', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti',
'Holy See', 'Honduras', 'Hong Kong, China', 'Hungary', 'Iceland',
'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 'Italy',
'Jamaica', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kiribati',
'Kuwait', 'Kyrgyz Republic', 'Lao', 'Latvia', 'Lebanon', 'Lesotho',
'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg',
'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta',
'Marshall Islands', 'Mauritania', 'Mauritius', 'Mexico',
'Micronesia, Fed. Sts.', 'Moldova', 'Monaco', 'Mongolia',
'Montenegro', 'Morocco', 'Mozambique', 'Myanmar', 'Namibia',
'Nauru', 'Nepal', 'Netherlands', 'New Zealand', 'Nicaragua',
'Niger', 'Nigeria', 'North Korea', 'North Macedonia', 'Norway',
'Oman', 'Pakistan', 'Palau', 'Palestine', 'Panama',
'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines', 'Poland',
'Portugal', 'Qatar', 'Romania', 'Russia', 'Rwanda', 'Samoa',
'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal',
'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore',
'Slovak Republic', 'Slovenia', 'Solomon Islands', 'Somalia',
'South Africa', 'South Korea', 'South Sudan', 'Spain', 'Sri Lanka',
'St. Kitts and Nevis', 'St. Lucia',
'St. Vincent and the Grenadines', 'Sudan', 'Suriname', 'Sweden',
'Switzerland', 'Syria', 'Taiwan', 'Tajikistan', 'Tanzania',
'Thailand', 'Timor-Leste', 'Togo', 'Tonga', 'Trinidad and Tobago',
'Tunisia', 'Turkey', 'Turkmenistan', 'Tuvalu', 'Uganda', 'Ukraine',
'United Arab Emirates', 'United Kingdom', 'United States',
'Uruguay', 'Uzbekistan', 'Vanuatu', 'Venezuela', 'Vietnam',
'Yemen', 'Zambia', 'Zimbabwe'], dtype=object)
murder
array(['Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra',
'Angola', 'Antigua and Barbuda', 'Argentina', 'Armenia',
'Australia', 'Austria', 'Azerbaijan', 'Bahamas', 'Bahrain',
'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin',
'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina',
'Botswana', 'Brazil', 'Brunei', 'Bulgaria', 'Burkina Faso',
'Burundi', 'Cambodia', 'Cameroon', 'Canada', 'Cape Verde',
'Central African Republic', 'Chad', 'Chile', 'China', 'Colombia',
'Comoros', 'Congo, Dem. Rep.', 'Congo, Rep.', 'Costa Rica',
"Cote d'Ivoire", 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic',
'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic', 'Ecuador',
'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia',
'Eswatini', 'Ethiopia', 'Fiji', 'Finland', 'France', 'Gabon',
'Gambia', 'Georgia', 'Germany', 'Ghana', 'Greece', 'Greenland',
'Grenada', 'Guam', 'Guatemala', 'Guinea', 'Guinea-Bissau',
'Guyana', 'Haiti', 'Honduras', 'Hungary', 'Iceland', 'India',
'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Israel', 'Italy',
'Jamaica', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Kiribati',
'Kuwait', 'Kyrgyz Republic', 'Lao', 'Latvia', 'Lebanon', 'Lesotho',
'Liberia', 'Libya', 'Lithuania', 'Luxembourg', 'Madagascar',
'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta',
'Marshall Islands', 'Mauritania', 'Mauritius', 'Mexico',
'Micronesia, Fed. Sts.', 'Moldova', 'Mongolia', 'Montenegro',
'Morocco', 'Mozambique', 'Myanmar', 'Namibia', 'Nepal',
'Netherlands', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria',
'North Korea', 'North Macedonia', 'Northern Mariana Islands',
'Norway', 'Oman', 'Pakistan', 'Palestine', 'Panama',
'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines', 'Poland',
'Portugal', 'Puerto Rico', 'Qatar', 'Romania', 'Russia', 'Rwanda',
'Samoa', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal',
'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore',
'Slovak Republic', 'Slovenia', 'Solomon Islands', 'Somalia',
'South Africa', 'South Korea', 'South Sudan', 'Spain', 'Sri Lanka',
'St. Lucia', 'St. Vincent and the Grenadines', 'Sudan', 'Suriname',
'Sweden', 'Switzerland', 'Syria', 'Taiwan', 'Tajikistan',
'Tanzania', 'Thailand', 'Timor-Leste', 'Togo', 'Tonga',
'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Turkmenistan',
'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom',
'United States', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Venezuela',
'Vietnam', 'Yemen', 'Zambia', 'Zimbabwe', nan, nan, nan],
dtype=object)
# I used for loop to go through the countries in the population list , then if this country not in the countries murder list . i will remove it from the data ...
for country in population:
if country not in murder:
population[population != country]
# Using the countries in the total murder as an index for the data..
murder_ratio.set_index("country_Murder", inplace = True)
# removing the column that have population countries ...
murder_ratio.drop(columns="country",inplace=True)
#Reseting the index to use numbers instead of the Countries in the total murder ...
murder_ratio.reset_index(inplace=True)
# Getting the Years that have Murder_counts in it and seperate it from the population years...
murder_columns_list = murder_ratio.columns
murder_years = murder_ratio.columns[murder_columns_list.get_indexer(["1990_Murder"])[0]:]
population_years = murder_ratio.columns[1:murder_columns_list.get_indexer(["1990_Murder"])[0]]
population_years
Index(['1990', '1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998',
'1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007',
'2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016'],
dtype='object')
# Comparing the length of two list to make sure that we have the same years ..
len(population_years)
27
len(murder_years)
27
# Getting the Murder ratio by dividing the total murder on the population number then multiplaying it with 100k to get it per 100k population ...Then i add the result in a new Columns and label them with the number of the year + Per 100k ..
for i in range(0,len(population_years)):
murder_ratio["{}_Per 100k".format(population_years[i])] = (murder_ratio[murder_years[i]] / murder_ratio[population_years[i]]) * 100000
murder_ratio
| country_Murder | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007_Per 100k | 2008_Per 100k | 2009_Per 100k | 2010_Per 100k | 2011_Per 100k | 2012_Per 100k | 2013_Per 100k | 2014_Per 100k | 2015_Per 100k | 2016_Per 100k | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 12400000.0 | 13300000.0 | 14500000.0 | 15800000.0 | 17100000.0 | 18100000.0 | 18900000.0 | 19400000.0 | 19700000.0 | ... | 18.118081 | 17.906137 | 17.570423 | 16.917808 | 16.677741 | 16.634615 | 17.213622 | 17.425150 | 17.616279 | 17.711864 |
| 1 | Angola | 11800000.0 | 12200000.0 | 12700000.0 | 13100000.0 | 13500000.0 | 13900000.0 | 14400000.0 | 14900000.0 | 15400000.0 | ... | 4.325359 | 4.299539 | 4.257778 | 4.179487 | 4.090909 | 4.023904 | 3.961538 | 3.903346 | 3.870968 | 3.784722 |
| 2 | Albania | 3290000.0 | 3280000.0 | 3250000.0 | 3200000.0 | 3150000.0 | 3110000.0 | 3100000.0 | 3100000.0 | 3110000.0 | ... | 2.729373 | 2.583333 | 2.272727 | 2.318644 | 2.337884 | 2.353952 | 2.368966 | 2.375862 | 2.394464 | 2.404844 |
| 3 | Andorra | 54500.0 | 56700.0 | 58900.0 | 61000.0 | 62700.0 | 63900.0 | 64400.0 | 64300.0 | 64100.0 | ... | 0.628779 | 0.619785 | 0.627219 | 0.639053 | 0.645161 | 0.655340 | 0.680693 | 0.694444 | 0.705128 | 0.711514 |
| 4 | United Arab Emirates | 1830000.0 | 1940000.0 | 2050000.0 | 2170000.0 | 2290000.0 | 2420000.0 | 2540000.0 | 2670000.0 | 2810000.0 | ... | 1.324149 | 1.338505 | 1.376263 | 1.426901 | 1.441341 | 1.444201 | 1.445652 | 1.444083 | 1.436285 | 1.410256 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 192 | Zambia | 163000.0 | 164000.0 | 165000.0 | 167000.0 | 169000.0 | 170000.0 | 171000.0 | 172000.0 | 173000.0 | ... | 681.318681 | 699.453552 | 702.702703 | 715.053763 | 732.620321 | 730.158730 | 738.219895 | 744.791667 | 752.577320 | 769.230769 |
| 193 | Zimbabwe | 11700000.0 | 12300000.0 | 13000000.0 | 13600000.0 | 14300000.0 | 14900000.0 | 15500000.0 | 16000000.0 | 16500000.0 | ... | 6.197183 | 6.210046 | 6.177778 | 6.077586 | 6.050420 | 5.918367 | 5.936255 | 5.968992 | 5.962264 | 6.066176 |
| 194 | NaN | 36800000.0 | 37700000.0 | 38700000.0 | 39600000.0 | 40600000.0 | 41400000.0 | 42200000.0 | 43000000.0 | 43700000.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 195 | NaN | 8040000.0 | 8250000.0 | 8450000.0 | 8660000.0 | 8870000.0 | 9100000.0 | 9340000.0 | 9600000.0 | 9870000.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 196 | NaN | 10400000.0 | 10700000.0 | 10900000.0 | 11100000.0 | 11300000.0 | 11400000.0 | 11500000.0 | 11700000.0 | 11700000.0 | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
197 rows × 82 columns
#Removing the other years coulmns that doesnt have Per 100k since we only need the raito..
for i in range(0,len(population_years)):
murder_ratio.drop(population_years[i], axis=1,inplace=True)
murder_ratio.drop(murder_years[i], axis=1,inplace=True)
murder_ratio
| country_Murder | 1990_Per 100k | 1991_Per 100k | 1992_Per 100k | 1993_Per 100k | 1994_Per 100k | 1995_Per 100k | 1996_Per 100k | 1997_Per 100k | 1998_Per 100k | ... | 2007_Per 100k | 2008_Per 100k | 2009_Per 100k | 2010_Per 100k | 2011_Per 100k | 2012_Per 100k | 2013_Per 100k | 2014_Per 100k | 2015_Per 100k | 2016_Per 100k | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 16.693548 | 16.541353 | 16.413793 | 16.455696 | 16.549708 | 16.685083 | 16.719577 | 16.855670 | 17.005076 | ... | 18.118081 | 17.906137 | 17.570423 | 16.917808 | 16.677741 | 16.634615 | 17.213622 | 17.425150 | 17.616279 | 17.711864 |
| 1 | Angola | 4.466102 | 4.360656 | 4.275591 | 4.343511 | 4.429630 | 4.374101 | 4.041667 | 3.906040 | 4.331169 | ... | 4.325359 | 4.299539 | 4.257778 | 4.179487 | 4.090909 | 4.023904 | 3.961538 | 3.903346 | 3.870968 | 3.784722 |
| 2 | Albania | 4.863222 | 5.548780 | 6.184615 | 6.906250 | 7.587302 | 8.585209 | 9.516129 | 10.548387 | 10.868167 | ... | 2.729373 | 2.583333 | 2.272727 | 2.318644 | 2.337884 | 2.353952 | 2.368966 | 2.375862 | 2.394464 | 2.404844 |
| 3 | Andorra | 0.880734 | 0.899471 | 0.916808 | 0.901639 | 0.877193 | 0.829421 | 0.791925 | 0.777605 | 0.764431 | ... | 0.628779 | 0.619785 | 0.627219 | 0.639053 | 0.645161 | 0.655340 | 0.680693 | 0.694444 | 0.705128 | 0.711514 |
| 4 | United Arab Emirates | 1.715847 | 1.628866 | 1.570732 | 1.529954 | 1.502183 | 1.479339 | 1.460630 | 1.441948 | 1.430605 | ... | 1.324149 | 1.338505 | 1.376263 | 1.426901 | 1.441341 | 1.444201 | 1.445652 | 1.444083 | 1.436285 | 1.410256 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 192 | Zambia | 269.325153 | 294.512195 | 318.787879 | 341.317365 | 367.455621 | 399.411765 | 435.672515 | 470.930233 | 511.560694 | ... | 681.318681 | 699.453552 | 702.702703 | 715.053763 | 732.620321 | 730.158730 | 738.219895 | 744.791667 | 752.577320 | 769.230769 |
| 193 | Zimbabwe | 5.273504 | 4.585366 | 4.338462 | 4.235294 | 4.244755 | 4.557047 | 4.600000 | 4.918750 | 5.412121 | ... | 6.197183 | 6.210046 | 6.177778 | 6.077586 | 6.050420 | 5.918367 | 5.936255 | 5.968992 | 5.962264 | 6.066176 |
| 194 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 195 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 196 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
197 rows × 28 columns
# Changing country_Murder_counts to Country since this is the only column that have countries in it ....
murder_ratio.columns = murder_ratio.columns.str.replace(r'_[^_]*$', '',regex=True)
murder_ratio
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 16.693548 | 16.541353 | 16.413793 | 16.455696 | 16.549708 | 16.685083 | 16.719577 | 16.855670 | 17.005076 | ... | 18.118081 | 17.906137 | 17.570423 | 16.917808 | 16.677741 | 16.634615 | 17.213622 | 17.425150 | 17.616279 | 17.711864 |
| 1 | Angola | 4.466102 | 4.360656 | 4.275591 | 4.343511 | 4.429630 | 4.374101 | 4.041667 | 3.906040 | 4.331169 | ... | 4.325359 | 4.299539 | 4.257778 | 4.179487 | 4.090909 | 4.023904 | 3.961538 | 3.903346 | 3.870968 | 3.784722 |
| 2 | Albania | 4.863222 | 5.548780 | 6.184615 | 6.906250 | 7.587302 | 8.585209 | 9.516129 | 10.548387 | 10.868167 | ... | 2.729373 | 2.583333 | 2.272727 | 2.318644 | 2.337884 | 2.353952 | 2.368966 | 2.375862 | 2.394464 | 2.404844 |
| 3 | Andorra | 0.880734 | 0.899471 | 0.916808 | 0.901639 | 0.877193 | 0.829421 | 0.791925 | 0.777605 | 0.764431 | ... | 0.628779 | 0.619785 | 0.627219 | 0.639053 | 0.645161 | 0.655340 | 0.680693 | 0.694444 | 0.705128 | 0.711514 |
| 4 | United Arab Emirates | 1.715847 | 1.628866 | 1.570732 | 1.529954 | 1.502183 | 1.479339 | 1.460630 | 1.441948 | 1.430605 | ... | 1.324149 | 1.338505 | 1.376263 | 1.426901 | 1.441341 | 1.444201 | 1.445652 | 1.444083 | 1.436285 | 1.410256 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 192 | Zambia | 269.325153 | 294.512195 | 318.787879 | 341.317365 | 367.455621 | 399.411765 | 435.672515 | 470.930233 | 511.560694 | ... | 681.318681 | 699.453552 | 702.702703 | 715.053763 | 732.620321 | 730.158730 | 738.219895 | 744.791667 | 752.577320 | 769.230769 |
| 193 | Zimbabwe | 5.273504 | 4.585366 | 4.338462 | 4.235294 | 4.244755 | 4.557047 | 4.600000 | 4.918750 | 5.412121 | ... | 6.197183 | 6.210046 | 6.177778 | 6.077586 | 6.050420 | 5.918367 | 5.936255 | 5.968992 | 5.962264 | 6.066176 |
| 194 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 195 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| 196 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
197 rows × 28 columns
murder_ratio = murder_ratio[0:194]
sum(murder_ratio.isnull().sum())
0
murder_ratio
| country | 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Afghanistan | 16.693548 | 16.541353 | 16.413793 | 16.455696 | 16.549708 | 16.685083 | 16.719577 | 16.855670 | 17.005076 | ... | 18.118081 | 17.906137 | 17.570423 | 16.917808 | 16.677741 | 16.634615 | 17.213622 | 17.425150 | 17.616279 | 17.711864 |
| 1 | Angola | 4.466102 | 4.360656 | 4.275591 | 4.343511 | 4.429630 | 4.374101 | 4.041667 | 3.906040 | 4.331169 | ... | 4.325359 | 4.299539 | 4.257778 | 4.179487 | 4.090909 | 4.023904 | 3.961538 | 3.903346 | 3.870968 | 3.784722 |
| 2 | Albania | 4.863222 | 5.548780 | 6.184615 | 6.906250 | 7.587302 | 8.585209 | 9.516129 | 10.548387 | 10.868167 | ... | 2.729373 | 2.583333 | 2.272727 | 2.318644 | 2.337884 | 2.353952 | 2.368966 | 2.375862 | 2.394464 | 2.404844 |
| 3 | Andorra | 0.880734 | 0.899471 | 0.916808 | 0.901639 | 0.877193 | 0.829421 | 0.791925 | 0.777605 | 0.764431 | ... | 0.628779 | 0.619785 | 0.627219 | 0.639053 | 0.645161 | 0.655340 | 0.680693 | 0.694444 | 0.705128 | 0.711514 |
| 4 | United Arab Emirates | 1.715847 | 1.628866 | 1.570732 | 1.529954 | 1.502183 | 1.479339 | 1.460630 | 1.441948 | 1.430605 | ... | 1.324149 | 1.338505 | 1.376263 | 1.426901 | 1.441341 | 1.444201 | 1.445652 | 1.444083 | 1.436285 | 1.410256 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 189 | Samoa | 0.037959 | 0.037562 | 0.037136 | 0.036762 | 0.036186 | 0.035662 | 0.035223 | 0.034956 | 0.034378 | ... | 0.028456 | 0.027935 | 0.027750 | 0.027641 | 0.027266 | 0.026939 | 0.026779 | 0.026733 | 0.026744 | 0.026823 |
| 190 | Yemen | 0.523529 | 0.537464 | 0.554302 | 0.572614 | 0.587517 | 0.600801 | 0.611038 | 0.621271 | 0.631242 | ... | 0.799766 | 0.819026 | 0.835821 | 0.846591 | 0.861642 | 0.880846 | 0.903084 | 0.920393 | 0.944984 | 0.967949 |
| 191 | South Africa | 11700.680272 | 11721.854305 | 11806.451613 | 11437.500000 | 11341.463415 | 11011.904762 | 10930.232558 | 11314.285714 | 11460.674157 | ... | 10365.296804 | 9600.000000 | 9043.478261 | 8516.949153 | 7983.539095 | 7440.000000 | 7120.622568 | 6969.696970 | 6937.269373 | 6906.474820 |
| 192 | Zambia | 269.325153 | 294.512195 | 318.787879 | 341.317365 | 367.455621 | 399.411765 | 435.672515 | 470.930233 | 511.560694 | ... | 681.318681 | 699.453552 | 702.702703 | 715.053763 | 732.620321 | 730.158730 | 738.219895 | 744.791667 | 752.577320 | 769.230769 |
| 193 | Zimbabwe | 5.273504 | 4.585366 | 4.338462 | 4.235294 | 4.244755 | 4.557047 | 4.600000 | 4.918750 | 5.412121 | ... | 6.197183 | 6.210046 | 6.177778 | 6.077586 | 6.050420 | 5.918367 | 5.936255 | 5.968992 | 5.962264 | 6.066176 |
194 rows × 28 columns
# new_murder = countries(murder_ratio)
murder_ratio.set_index("country", inplace = True)
murder_ratio = murder_ratio.T
murder_ratio.columns.rename(name="Years",inplace=True) # --> Renaming the country name to Years...
murder_ratio
| Years | Afghanistan | Angola | Albania | Andorra | United Arab Emirates | Argentina | Armenia | American Samoa | Antigua and Barbuda | Australia | ... | Uzbekistan | St. Vincent and the Grenadines | Venezuela | Vietnam | Vanuatu | Samoa | Yemen | South Africa | Zambia | Zimbabwe |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1990 | 16.693548 | 4.466102 | 4.863222 | 0.880734 | 1.715847 | 6.012270 | 4.661017 | 4.944000 | 0.013000 | 4.702073 | ... | 1.780583 | 0.369775 | 1.281746 | 6.715686 | 1.560748 | 0.037959 | 0.523529 | 11700.680272 | 269.325153 | 5.273504 |
| 1991 | 16.541353 | 4.360656 | 5.548780 | 0.899471 | 1.628866 | 5.981873 | 5.299145 | 4.984227 | 0.013372 | 4.568855 | ... | 1.852427 | 0.386581 | 1.400000 | 6.746411 | 1.629630 | 0.037562 | 0.537464 | 11721.854305 | 294.512195 | 4.585366 |
| 1992 | 16.413793 | 4.275591 | 6.184615 | 0.916808 | 1.570732 | 6.059701 | 5.843023 | 4.961240 | 0.013851 | 4.444444 | ... | 1.920233 | 0.403175 | 1.513619 | 6.728972 | 1.722222 | 0.037136 | 0.554302 | 11806.451613 | 318.787879 | 4.338462 |
| 1993 | 16.455696 | 4.343511 | 6.906250 | 0.901639 | 1.529954 | 6.088235 | 6.547619 | 4.878419 | 0.014091 | 4.334601 | ... | 1.968811 | 0.411950 | 1.607692 | 6.712329 | 1.805556 | 0.036762 | 0.572614 | 11437.500000 | 341.317365 | 4.235294 |
| 1994 | 16.549708 | 4.429630 | 7.587302 | 0.877193 | 1.502183 | 6.191860 | 6.554878 | 4.836310 | 0.014663 | 4.301887 | ... | 2.035225 | 0.425000 | 1.698473 | 6.726457 | 1.888889 | 0.036186 | 0.587517 | 11341.463415 | 367.455621 | 4.244755 |
| 1995 | 16.685083 | 4.374101 | 8.585209 | 0.829421 | 1.479339 | 6.149425 | 6.366460 | 4.788937 | 0.015500 | 4.280350 | ... | 2.043222 | 0.431677 | 1.766038 | 6.710526 | 1.944444 | 0.035662 | 0.600801 | 11011.904762 | 399.411765 | 4.557047 |
| 1996 | 16.719577 | 4.041667 | 9.516129 | 0.791925 | 1.460630 | 6.193182 | 6.151420 | 4.772080 | 0.015440 | 4.226933 | ... | 2.055336 | 0.430769 | 1.798507 | 6.724138 | 2.000000 | 0.035223 | 0.611038 | 10930.232558 | 435.672515 | 4.600000 |
| 1997 | 16.855670 | 3.906040 | 10.548387 | 0.777605 | 1.441948 | 6.134454 | 5.591054 | 4.755927 | 0.015815 | 4.209215 | ... | 2.011952 | 0.440367 | 1.790441 | 6.694915 | 2.055556 | 0.034956 | 0.621271 | 11314.285714 | 470.930233 | 4.918750 |
| 1998 | 17.005076 | 4.331169 | 10.868167 | 0.764431 | 1.430605 | 6.094183 | 5.273312 | 4.631148 | 0.016452 | 4.203980 | ... | 1.981891 | 0.458967 | 1.938182 | 6.666667 | 2.129630 | 0.034378 | 0.631242 | 11460.674157 | 511.560694 | 5.412121 |
| 1999 | 17.079208 | 4.150943 | 9.903846 | 0.745342 | 1.417508 | 6.219178 | 4.983819 | 4.564926 | 0.017021 | 4.161491 | ... | 1.943205 | 0.447130 | 2.114695 | 6.680328 | 2.222222 | 0.033882 | 0.641772 | 11823.204420 | 548.275862 | 6.035503 |
| 2000 | 17.259615 | 4.097561 | 8.306709 | 0.718654 | 1.402556 | 6.368564 | 4.462541 | 4.644737 | 0.017000 | 4.089219 | ... | 1.948770 | 0.439759 | 2.411348 | 6.653226 | 2.287037 | 0.032769 | 0.652065 | 12540.540541 | 571.839080 | 6.666667 |
| 2001 | 17.546296 | 4.106509 | 7.156550 | 0.683507 | 1.418182 | 6.407507 | 4.229508 | 4.766839 | 0.018698 | 3.962963 | ... | 1.946281 | 0.459459 | 2.621053 | 6.653386 | 2.361111 | 0.032073 | 0.666667 | 12275.132275 | 582.857143 | 6.648045 |
| 2002 | 17.654867 | 4.108571 | 6.038339 | 0.642857 | 1.442529 | 6.419098 | 4.158416 | 4.853129 | 0.018711 | 3.862239 | ... | 1.941667 | 0.477477 | 2.843206 | 6.574803 | 2.435185 | 0.031235 | 0.683436 | 12216.494845 | 596.590909 | 6.847826 |
| 2003 | 18.185654 | 4.232044 | 4.967949 | 0.628415 | 1.433962 | 6.089239 | 4.105960 | 4.817150 | 0.019643 | 3.728606 | ... | 1.911765 | 0.496988 | 3.117241 | 6.536965 | 2.500000 | 0.030391 | 0.698663 | 12110.552764 | 621.468927 | 6.842105 |
| 2004 | 18.502024 | 4.351064 | 4.000000 | 0.642202 | 1.380835 | 5.792208 | 4.233333 | 4.694894 | 0.020503 | 3.576642 | ... | 1.947034 | 0.536145 | 3.113014 | 6.475096 | 2.541284 | 0.029846 | 0.719615 | 11813.725490 | 636.871508 | 6.871795 |
| 2005 | 18.482490 | 4.355670 | 3.055016 | 0.633714 | 1.372549 | 5.655527 | 4.395973 | 4.601227 | 0.022277 | 3.539394 | ... | 2.006397 | 0.563253 | 3.193220 | 6.401515 | 2.623853 | 0.029280 | 0.756563 | 11483.253589 | 655.555556 | 6.716418 |
| 2006 | 18.371212 | 4.358209 | 2.709150 | 0.629630 | 1.307547 | 5.674300 | 4.527027 | 4.437727 | 0.022488 | 3.606755 | ... | 2.045064 | 0.573574 | 3.422819 | 6.455224 | 2.697248 | 0.028662 | 0.775414 | 11121.495327 | 674.033149 | 6.473430 |
| 2007 | 18.118081 | 4.325359 | 2.729373 | 0.628779 | 1.324149 | 5.566751 | 4.539249 | 4.285714 | 0.023636 | 3.622142 | ... | 2.081897 | 0.600601 | 3.621262 | 6.544118 | 2.816514 | 0.028456 | 0.799766 | 10365.296804 | 681.318681 | 6.197183 |
| 2008 | 17.906137 | 4.299539 | 2.583333 | 0.619785 | 1.338505 | 5.685786 | 4.639175 | 4.180328 | 0.023286 | 3.681055 | ... | 2.123377 | 0.592814 | 3.762376 | 6.666667 | 2.916667 | 0.027935 | 0.819026 | 9600.000000 | 699.453552 | 6.210046 |
| 2009 | 17.570423 | 4.257778 | 2.272727 | 0.627219 | 1.376263 | 5.753086 | 4.567474 | 4.175317 | 0.023991 | 3.691756 | ... | 2.145652 | 0.605970 | 3.823529 | 6.548043 | 2.990741 | 0.027750 | 0.835821 | 9043.478261 | 702.702703 | 6.177778 |
| 2010 | 16.917808 | 4.179487 | 2.318644 | 0.639053 | 1.426901 | 5.843521 | 4.444444 | 4.193182 | 0.022207 | 3.662307 | ... | 2.183406 | 0.619048 | 3.721683 | 6.491228 | 3.064815 | 0.027641 | 0.846591 | 8516.949153 | 715.053763 | 6.077586 |
| 2011 | 16.677741 | 4.090909 | 2.337884 | 0.645161 | 1.441341 | 5.956416 | 4.375000 | 4.188130 | 0.021556 | 3.609467 | ... | 2.192982 | 0.635015 | 3.750000 | 6.379310 | 3.111111 | 0.027266 | 0.861642 | 7983.539095 | 732.620321 | 6.050420 |
| 2012 | 16.634615 | 4.023904 | 2.353952 | 0.655340 | 1.444201 | 6.076555 | 4.305556 | 4.214602 | 0.020917 | 3.576471 | ... | 2.241758 | 0.642012 | 3.853503 | 6.326531 | 3.166667 | 0.026939 | 0.880846 | 7440.000000 | 730.158730 | 5.918367 |
| 2013 | 17.213622 | 3.961538 | 2.368966 | 0.680693 | 1.445652 | 6.232227 | 4.068966 | 4.273224 | 0.020558 | 3.492991 | ... | 2.273731 | 0.660767 | 3.860759 | 6.220736 | 3.220183 | 0.026779 | 0.903084 | 7120.622568 | 738.219895 | 5.936255 |
| 2014 | 17.425150 | 3.903346 | 2.375862 | 0.694444 | 1.444083 | 6.291080 | 3.917526 | 4.330454 | 0.020508 | 3.503480 | ... | 2.305987 | 0.673529 | 3.855799 | 6.118421 | 3.302752 | 0.026733 | 0.920393 | 6969.696970 | 744.791667 | 5.968992 |
| 2015 | 17.616279 | 3.870968 | 2.394464 | 0.705128 | 1.436285 | 6.148492 | 3.890785 | 4.369658 | 0.020293 | 3.525346 | ... | 2.360802 | 0.674487 | 3.862928 | 6.051780 | 3.376147 | 0.026744 | 0.944984 | 6937.269373 | 752.577320 | 5.962264 |
| 2016 | 17.711864 | 3.784722 | 2.404844 | 0.711514 | 1.410256 | 6.000000 | 3.911565 | 4.380952 | 0.019959 | 3.542857 | ... | 2.393736 | 0.660819 | 3.869969 | 5.955414 | 3.458716 | 0.026823 | 0.967949 | 6906.474820 | 769.230769 | 6.066176 |
27 rows × 194 columns
df_GDP.set_index("Country",inplace=True)
df_GDP
| 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | 1999 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Country | |||||||||||||||||||||
| Aruba | 3.961402 | 7.962872 | 5.882353 | 7.307692 | 8.203903 | 2.547144 | 1.185788 | 7.046874 | 1.991986 | 1.238042 | ... | 1.800226 | -0.090708 | -10.519749 | -3.685029 | 3.446055 | -1.369863 | 4.198232 | 0.300000 | 5.700001 | 2.100000 |
| Africa Eastern and Southern | 0.050826 | -0.095421 | -2.343192 | -1.089417 | 2.051914 | 4.409975 | 5.570030 | 3.425412 | 1.789507 | 2.603876 | ... | 6.857304 | 4.572539 | 0.946811 | 5.152336 | 4.014183 | 1.972652 | 4.308370 | 3.986754 | 2.925591 | 2.019391 |
| Afghanistan | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | ... | 13.826320 | 3.924984 | 21.390528 | 14.362441 | 0.426355 | 12.752287 | 5.600745 | 2.724543 | 1.451315 | 2.260314 |
| Africa Western and Central | 6.562921 | 1.121069 | 2.693959 | -1.160468 | -0.299641 | 1.927028 | 4.629048 | 4.234699 | 3.506516 | 1.421036 | ... | 5.530987 | 6.279223 | 6.274463 | 6.957010 | 4.848351 | 5.142964 | 6.104241 | 5.927350 | 2.745937 | 0.127595 |
| Angola | -3.450099 | 0.991359 | -5.838281 | -23.983417 | 1.339363 | 15.000000 | 13.544370 | 7.274277 | 4.691146 | 2.181490 | ... | 14.010018 | 11.166138 | 0.858713 | 4.403933 | 3.471976 | 8.542188 | 4.954545 | 4.822628 | 0.943572 | -2.580050 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| Kosovo | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | ... | 0.000000 | 0.000000 | 5.034884 | 4.939924 | 6.319886 | 1.712195 | 5.340908 | 3.348804 | 5.916270 | 5.571757 |
| Yemen, Rep. | 0.000000 | 6.293494 | 8.207598 | 4.001966 | 6.721949 | 5.669371 | 4.634967 | 5.231112 | 6.006695 | 3.775530 | ... | 3.338428 | 3.647569 | 3.866230 | 7.702307 | -12.714823 | 2.392886 | 4.823415 | -0.188574 | -27.994546 | -9.375124 |
| South Africa | -0.317786 | -1.018220 | -2.137057 | 1.233520 | 3.200000 | 3.100000 | 4.300000 | 2.600000 | 0.500000 | 2.400000 | ... | 5.360474 | 3.191044 | -1.538089 | 3.039733 | 3.168556 | 2.396232 | 2.485468 | 1.413826 | 1.321862 | 0.664552 |
| Zambia | -0.481072 | -0.036133 | -1.730922 | 6.797274 | -8.625442 | 2.897669 | 6.218546 | 3.814007 | -0.385746 | 4.650190 | ... | 8.352436 | 7.773896 | 9.220348 | 10.298223 | 5.564602 | 7.597593 | 5.057232 | 4.697992 | 2.920375 | 3.776679 |
| Zimbabwe | 6.988553 | 5.531782 | -9.015570 | 1.051459 | 9.235199 | 0.158026 | 10.360697 | 2.680594 | 2.885212 | -0.817821 | ... | -3.653327 | -17.668946 | 12.019560 | 19.675323 | 14.193913 | 16.665429 | 1.989493 | 2.376929 | 1.779873 | 0.755869 |
266 rows × 27 columns
df_GDP = df_GDP.T
df_GDP
| Country | Aruba | Africa Eastern and Southern | Afghanistan | Africa Western and Central | Angola | Albania | Andorra | Arab World | United Arab Emirates | Argentina | ... | Virgin Islands (U.S.) | Vietnam | Vanuatu | World | Samoa | Kosovo | Yemen, Rep. | South Africa | Zambia | Zimbabwe |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1990 | 3.961402 | 0.050826 | 0.000000 | 6.562921 | -3.450099 | -9.575640 | 3.781388 | 12.373098 | 18.327986 | -2.467214 | ... | 0.000000 | 5.100918 | 11.695700 | 2.876178 | -4.421451 | 0.000000 | 0.000000 | -0.317786 | -0.481072 | 6.988553 |
| 1991 | 7.962872 | -0.095421 | 0.000000 | 1.121069 | 0.991359 | -28.002142 | 2.546004 | 2.337089 | 0.860082 | 9.133111 | ... | 0.000000 | 5.960844 | 3.147638 | 1.446386 | -2.300009 | 0.000000 | 6.293494 | -1.018220 | -0.036133 | 5.531782 |
| 1992 | 5.882353 | -2.343192 | 0.000000 | 2.693959 | -5.838281 | -7.187111 | 0.929214 | 5.163188 | 3.344945 | 7.937292 | ... | 0.000000 | 8.646047 | 2.585414 | 2.056186 | -0.199992 | 0.000000 | 8.207598 | -2.137057 | -1.730922 | -9.015570 |
| 1993 | 7.307692 | -1.089417 | 0.000000 | -1.160468 | -23.983417 | 9.559412 | -1.031484 | 3.141588 | 1.261191 | 8.206979 | ... | 0.000000 | 8.072731 | 0.735448 | 1.808395 | 4.099990 | 0.000000 | 4.001966 | 1.233520 | 6.797274 | 1.051459 |
| 1994 | 8.203903 | 2.051914 | 0.000000 | -0.299641 | 1.339363 | 8.302867 | 2.383182 | 3.322772 | 6.896149 | 5.836201 | ... | 0.000000 | 8.838981 | 9.081466 | 3.296975 | -2.542099 | 0.000000 | 6.721949 | 3.200000 | -8.625442 | 9.235199 |
| 1995 | 2.547144 | 4.409975 | 0.000000 | 1.927028 | 15.000000 | 13.322333 | 2.757502 | 2.990042 | 6.687886 | -2.845210 | ... | 0.000000 | 9.540480 | 1.003945 | 3.089415 | 6.673643 | 0.000000 | 5.669371 | 3.100000 | 2.897669 | 0.158026 |
| 1996 | 1.185788 | 5.570030 | 0.000000 | 4.629048 | 13.544370 | 9.099999 | 4.649739 | 4.693627 | 5.798404 | 5.526690 | ... | 0.000000 | 9.340017 | 2.327335 | 3.613833 | 7.178972 | 0.000000 | 4.634967 | 4.300000 | 6.218546 | 10.360697 |
| 1997 | 7.046874 | 3.425412 | 0.000000 | 4.234699 | 7.274277 | -10.919984 | 9.067672 | 4.323094 | 8.190399 | 8.111047 | ... | 0.000000 | 8.152084 | 4.906813 | 3.869133 | 0.643422 | 0.000000 | 5.231112 | 2.600000 | 3.814007 | 2.680594 |
| 1998 | 1.991986 | 1.789507 | 0.000000 | 3.506516 | 4.691146 | 8.829424 | 3.194793 | 5.148232 | 0.291994 | 3.850179 | ... | 0.000000 | 5.764455 | 1.176854 | 2.793154 | 2.194889 | 0.000000 | 6.006695 | 0.500000 | -0.385746 | 2.885212 |
| 1999 | 1.238042 | 2.603876 | 0.000000 | 1.421036 | 2.181490 | 12.890804 | 4.099079 | 1.809676 | 2.902214 | -3.385457 | ... | 0.000000 | 4.773587 | 0.337293 | 3.504464 | 2.185433 | 0.000000 | 3.775530 | 2.400000 | 4.650190 | -0.817821 |
| 2000 | 7.616588 | 3.197143 | 0.000000 | 3.734635 | 3.054624 | 6.946217 | 3.528362 | 6.599485 | 10.852704 | -0.788999 | ... | 0.000000 | 6.787316 | 5.924809 | 4.501278 | 6.918794 | 0.000000 | 6.181916 | 4.200000 | 3.897323 | -3.059190 |
| 2001 | -2.971257 | 3.526480 | 0.000000 | 5.212695 | 4.205999 | 8.293313 | 8.119358 | 1.684811 | 1.399085 | -4.408840 | ... | 0.000000 | 6.192893 | -3.397582 | 2.000111 | 6.939762 | 0.000000 | 3.803646 | 2.700000 | 5.316868 | 1.439615 |
| 2002 | -3.273646 | 3.992607 | 0.000000 | 9.899591 | 13.665687 | 4.536524 | 4.546362 | 0.605117 | 2.433457 | -10.894485 | ... | 0.000000 | 6.320821 | -5.198319 | 2.337281 | 4.343996 | 0.000000 | 3.935232 | 3.700374 | 4.506014 | -8.894024 |
| 2003 | 1.975547 | 2.908004 | 8.832278 | 5.518510 | 2.989850 | 5.528637 | 8.694204 | 4.713562 | 8.800541 | 8.837041 | ... | -0.396081 | 6.899063 | 4.288335 | 3.159531 | 4.515482 | 0.000000 | 3.747398 | 2.949075 | 6.944974 | -16.995075 |
| 2004 | 7.911563 | 5.656582 | 1.414118 | 8.013486 | 10.952862 | 5.514668 | 8.135676 | 9.004155 | 9.566437 | 9.029573 | ... | 3.285894 | 7.536411 | 3.987393 | 4.480070 | 4.625001 | 0.000000 | 3.972696 | 4.554560 | 7.032395 | -5.807538 |
| 2005 | 1.214349 | 6.361804 | 11.229715 | 5.848351 | 15.028915 | 5.526424 | 5.397796 | 5.415001 | 4.855141 | 8.851660 | ... | 3.485309 | 7.547248 | 5.305326 | 4.048361 | 4.156490 | 0.000000 | 5.591748 | 5.277052 | 7.235599 | -5.711084 |
| 2006 | 1.050608 | 6.688755 | 5.357403 | 5.374463 | 11.547683 | 5.902659 | 4.808689 | 6.065760 | 9.837320 | 8.047152 | ... | 3.504993 | 6.977955 | 8.465160 | 4.495723 | 1.968808 | 0.000000 | 3.170409 | 5.603806 | 7.903694 | -3.461495 |
| 2007 | 1.800226 | 6.857304 | 13.826320 | 5.530987 | 14.010018 | 5.983260 | 1.553188 | 4.524154 | 3.184390 | 9.007651 | ... | 4.010594 | 7.129504 | 2.871660 | 4.438864 | 6.322645 | 0.000000 | 3.338428 | 5.360474 | 8.352436 | -3.653327 |
| 2008 | -0.090708 | 4.572539 | 3.924984 | 6.279223 | 11.166138 | 7.500041 | -5.559186 | 5.773995 | 3.191836 | 4.057233 | ... | 1.218625 | 5.661771 | 5.602991 | 2.000950 | 1.009088 | 0.000000 | 3.647569 | 3.191044 | 7.773896 | -17.668946 |
| 2009 | -10.519749 | 0.946811 | 21.390528 | 6.274463 | 0.858713 | 3.354289 | -5.302847 | 0.643073 | -5.242922 | -5.918525 | ... | -6.594789 | 5.397898 | 3.037246 | -1.307019 | -4.808274 | 5.034884 | 3.866230 | -1.538089 | 9.220348 | 12.019560 |
| 2010 | -3.685029 | 5.152336 | 14.362441 | 6.957010 | 4.403933 | 3.706938 | -1.974958 | 4.776624 | 1.602850 | 10.125398 | ... | 0.596383 | 6.423238 | 1.260682 | 4.494860 | 0.467246 | 4.939924 | 7.702307 | 3.039733 | 10.298223 | 19.675323 |
| 2011 | 3.446055 | 4.014183 | 0.426355 | 4.848351 | 3.471976 | 2.545406 | -0.008070 | 3.806778 | 6.928509 | 6.003952 | ... | -8.204246 | 6.240303 | 3.137874 | 3.339731 | 4.103641 | 6.319886 | -12.714823 | 3.168556 | 5.564602 | 14.193913 |
| 2012 | -1.369863 | 1.972652 | 12.752287 | 5.142964 | 8.542188 | 1.417243 | -4.974444 | 5.041890 | 4.483792 | -1.026420 | ... | -14.812500 | 5.247367 | 1.010030 | 2.673060 | -4.084494 | 1.712195 | 2.392886 | 2.396232 | 7.597593 | 16.665429 |
| 2013 | 4.198232 | 4.308370 | 5.600745 | 6.104241 | 4.954545 | 1.002018 | -3.547597 | 2.965049 | 5.053078 | 2.405324 | ... | -6.285155 | 5.421883 | 0.468608 | 2.844854 | -0.342327 | 5.340908 | 4.823415 | 2.485468 | 5.057232 | 1.989493 |
| 2014 | 0.300000 | 3.986754 | 2.724543 | 5.927350 | 4.822628 | 1.774449 | 2.504466 | 2.557937 | 4.410085 | -2.512615 | ... | -1.774530 | 5.983655 | 3.126246 | 3.117863 | 0.052171 | 3.348804 | -0.188574 | 1.413826 | 4.697992 | 2.376929 |
| 2015 | 5.700001 | 2.925591 | 1.451315 | 2.745937 | 0.943572 | 2.218726 | 1.434140 | 3.002276 | 5.060335 | 2.731160 | ... | -0.425080 | 6.679289 | 0.371578 | 3.168373 | 4.296881 | 5.916270 | -27.994546 | 1.321862 | 2.920375 | 1.779873 |
| 2016 | 2.100000 | 2.019391 | 2.260314 | 0.127595 | -2.580050 | 3.314981 | 3.709678 | 3.200034 | 2.984216 | -2.080328 | ... | 1.600854 | 6.210812 | 4.688678 | 2.825118 | 8.126249 | 5.571757 | -9.375124 | 0.664552 | 3.776679 | 0.755869 |
27 rows × 266 columns
df_GDP.columns.rename(name="Years",inplace=True) # --> Renaming the country name to Years...
df_GDP
| Years | Aruba | Africa Eastern and Southern | Afghanistan | Africa Western and Central | Angola | Albania | Andorra | Arab World | United Arab Emirates | Argentina | ... | Virgin Islands (U.S.) | Vietnam | Vanuatu | World | Samoa | Kosovo | Yemen, Rep. | South Africa | Zambia | Zimbabwe |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1990 | 3.961402 | 0.050826 | 0.000000 | 6.562921 | -3.450099 | -9.575640 | 3.781388 | 12.373098 | 18.327986 | -2.467214 | ... | 0.000000 | 5.100918 | 11.695700 | 2.876178 | -4.421451 | 0.000000 | 0.000000 | -0.317786 | -0.481072 | 6.988553 |
| 1991 | 7.962872 | -0.095421 | 0.000000 | 1.121069 | 0.991359 | -28.002142 | 2.546004 | 2.337089 | 0.860082 | 9.133111 | ... | 0.000000 | 5.960844 | 3.147638 | 1.446386 | -2.300009 | 0.000000 | 6.293494 | -1.018220 | -0.036133 | 5.531782 |
| 1992 | 5.882353 | -2.343192 | 0.000000 | 2.693959 | -5.838281 | -7.187111 | 0.929214 | 5.163188 | 3.344945 | 7.937292 | ... | 0.000000 | 8.646047 | 2.585414 | 2.056186 | -0.199992 | 0.000000 | 8.207598 | -2.137057 | -1.730922 | -9.015570 |
| 1993 | 7.307692 | -1.089417 | 0.000000 | -1.160468 | -23.983417 | 9.559412 | -1.031484 | 3.141588 | 1.261191 | 8.206979 | ... | 0.000000 | 8.072731 | 0.735448 | 1.808395 | 4.099990 | 0.000000 | 4.001966 | 1.233520 | 6.797274 | 1.051459 |
| 1994 | 8.203903 | 2.051914 | 0.000000 | -0.299641 | 1.339363 | 8.302867 | 2.383182 | 3.322772 | 6.896149 | 5.836201 | ... | 0.000000 | 8.838981 | 9.081466 | 3.296975 | -2.542099 | 0.000000 | 6.721949 | 3.200000 | -8.625442 | 9.235199 |
| 1995 | 2.547144 | 4.409975 | 0.000000 | 1.927028 | 15.000000 | 13.322333 | 2.757502 | 2.990042 | 6.687886 | -2.845210 | ... | 0.000000 | 9.540480 | 1.003945 | 3.089415 | 6.673643 | 0.000000 | 5.669371 | 3.100000 | 2.897669 | 0.158026 |
| 1996 | 1.185788 | 5.570030 | 0.000000 | 4.629048 | 13.544370 | 9.099999 | 4.649739 | 4.693627 | 5.798404 | 5.526690 | ... | 0.000000 | 9.340017 | 2.327335 | 3.613833 | 7.178972 | 0.000000 | 4.634967 | 4.300000 | 6.218546 | 10.360697 |
| 1997 | 7.046874 | 3.425412 | 0.000000 | 4.234699 | 7.274277 | -10.919984 | 9.067672 | 4.323094 | 8.190399 | 8.111047 | ... | 0.000000 | 8.152084 | 4.906813 | 3.869133 | 0.643422 | 0.000000 | 5.231112 | 2.600000 | 3.814007 | 2.680594 |
| 1998 | 1.991986 | 1.789507 | 0.000000 | 3.506516 | 4.691146 | 8.829424 | 3.194793 | 5.148232 | 0.291994 | 3.850179 | ... | 0.000000 | 5.764455 | 1.176854 | 2.793154 | 2.194889 | 0.000000 | 6.006695 | 0.500000 | -0.385746 | 2.885212 |
| 1999 | 1.238042 | 2.603876 | 0.000000 | 1.421036 | 2.181490 | 12.890804 | 4.099079 | 1.809676 | 2.902214 | -3.385457 | ... | 0.000000 | 4.773587 | 0.337293 | 3.504464 | 2.185433 | 0.000000 | 3.775530 | 2.400000 | 4.650190 | -0.817821 |
| 2000 | 7.616588 | 3.197143 | 0.000000 | 3.734635 | 3.054624 | 6.946217 | 3.528362 | 6.599485 | 10.852704 | -0.788999 | ... | 0.000000 | 6.787316 | 5.924809 | 4.501278 | 6.918794 | 0.000000 | 6.181916 | 4.200000 | 3.897323 | -3.059190 |
| 2001 | -2.971257 | 3.526480 | 0.000000 | 5.212695 | 4.205999 | 8.293313 | 8.119358 | 1.684811 | 1.399085 | -4.408840 | ... | 0.000000 | 6.192893 | -3.397582 | 2.000111 | 6.939762 | 0.000000 | 3.803646 | 2.700000 | 5.316868 | 1.439615 |
| 2002 | -3.273646 | 3.992607 | 0.000000 | 9.899591 | 13.665687 | 4.536524 | 4.546362 | 0.605117 | 2.433457 | -10.894485 | ... | 0.000000 | 6.320821 | -5.198319 | 2.337281 | 4.343996 | 0.000000 | 3.935232 | 3.700374 | 4.506014 | -8.894024 |
| 2003 | 1.975547 | 2.908004 | 8.832278 | 5.518510 | 2.989850 | 5.528637 | 8.694204 | 4.713562 | 8.800541 | 8.837041 | ... | -0.396081 | 6.899063 | 4.288335 | 3.159531 | 4.515482 | 0.000000 | 3.747398 | 2.949075 | 6.944974 | -16.995075 |
| 2004 | 7.911563 | 5.656582 | 1.414118 | 8.013486 | 10.952862 | 5.514668 | 8.135676 | 9.004155 | 9.566437 | 9.029573 | ... | 3.285894 | 7.536411 | 3.987393 | 4.480070 | 4.625001 | 0.000000 | 3.972696 | 4.554560 | 7.032395 | -5.807538 |
| 2005 | 1.214349 | 6.361804 | 11.229715 | 5.848351 | 15.028915 | 5.526424 | 5.397796 | 5.415001 | 4.855141 | 8.851660 | ... | 3.485309 | 7.547248 | 5.305326 | 4.048361 | 4.156490 | 0.000000 | 5.591748 | 5.277052 | 7.235599 | -5.711084 |
| 2006 | 1.050608 | 6.688755 | 5.357403 | 5.374463 | 11.547683 | 5.902659 | 4.808689 | 6.065760 | 9.837320 | 8.047152 | ... | 3.504993 | 6.977955 | 8.465160 | 4.495723 | 1.968808 | 0.000000 | 3.170409 | 5.603806 | 7.903694 | -3.461495 |
| 2007 | 1.800226 | 6.857304 | 13.826320 | 5.530987 | 14.010018 | 5.983260 | 1.553188 | 4.524154 | 3.184390 | 9.007651 | ... | 4.010594 | 7.129504 | 2.871660 | 4.438864 | 6.322645 | 0.000000 | 3.338428 | 5.360474 | 8.352436 | -3.653327 |
| 2008 | -0.090708 | 4.572539 | 3.924984 | 6.279223 | 11.166138 | 7.500041 | -5.559186 | 5.773995 | 3.191836 | 4.057233 | ... | 1.218625 | 5.661771 | 5.602991 | 2.000950 | 1.009088 | 0.000000 | 3.647569 | 3.191044 | 7.773896 | -17.668946 |
| 2009 | -10.519749 | 0.946811 | 21.390528 | 6.274463 | 0.858713 | 3.354289 | -5.302847 | 0.643073 | -5.242922 | -5.918525 | ... | -6.594789 | 5.397898 | 3.037246 | -1.307019 | -4.808274 | 5.034884 | 3.866230 | -1.538089 | 9.220348 | 12.019560 |
| 2010 | -3.685029 | 5.152336 | 14.362441 | 6.957010 | 4.403933 | 3.706938 | -1.974958 | 4.776624 | 1.602850 | 10.125398 | ... | 0.596383 | 6.423238 | 1.260682 | 4.494860 | 0.467246 | 4.939924 | 7.702307 | 3.039733 | 10.298223 | 19.675323 |
| 2011 | 3.446055 | 4.014183 | 0.426355 | 4.848351 | 3.471976 | 2.545406 | -0.008070 | 3.806778 | 6.928509 | 6.003952 | ... | -8.204246 | 6.240303 | 3.137874 | 3.339731 | 4.103641 | 6.319886 | -12.714823 | 3.168556 | 5.564602 | 14.193913 |
| 2012 | -1.369863 | 1.972652 | 12.752287 | 5.142964 | 8.542188 | 1.417243 | -4.974444 | 5.041890 | 4.483792 | -1.026420 | ... | -14.812500 | 5.247367 | 1.010030 | 2.673060 | -4.084494 | 1.712195 | 2.392886 | 2.396232 | 7.597593 | 16.665429 |
| 2013 | 4.198232 | 4.308370 | 5.600745 | 6.104241 | 4.954545 | 1.002018 | -3.547597 | 2.965049 | 5.053078 | 2.405324 | ... | -6.285155 | 5.421883 | 0.468608 | 2.844854 | -0.342327 | 5.340908 | 4.823415 | 2.485468 | 5.057232 | 1.989493 |
| 2014 | 0.300000 | 3.986754 | 2.724543 | 5.927350 | 4.822628 | 1.774449 | 2.504466 | 2.557937 | 4.410085 | -2.512615 | ... | -1.774530 | 5.983655 | 3.126246 | 3.117863 | 0.052171 | 3.348804 | -0.188574 | 1.413826 | 4.697992 | 2.376929 |
| 2015 | 5.700001 | 2.925591 | 1.451315 | 2.745937 | 0.943572 | 2.218726 | 1.434140 | 3.002276 | 5.060335 | 2.731160 | ... | -0.425080 | 6.679289 | 0.371578 | 3.168373 | 4.296881 | 5.916270 | -27.994546 | 1.321862 | 2.920375 | 1.779873 |
| 2016 | 2.100000 | 2.019391 | 2.260314 | 0.127595 | -2.580050 | 3.314981 | 3.709678 | 3.200034 | 2.984216 | -2.080328 | ... | 1.600854 | 6.210812 | 4.688678 | 2.825118 | 8.126249 | 5.571757 | -9.375124 | 0.664552 | 3.776679 | 0.755869 |
27 rows × 266 columns
df_Income.set_index("country",inplace=True) # Making the Country column my indeces ...
df_Income
| 1990 | 1991 | 1992 | 1993 | 1994 | 1995 | 1996 | 1997 | 1998 | 1999 | ... | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | 2016 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| country | |||||||||||||||||||||
| Afghanistan | 1110.0 | 1010.0 | 971.0 | 665.0 | 493.0 | 728.0 | 690.0 | 656.0 | 627.0 | 597.0 | ... | 1460.0 | 1480.0 | 1760.0 | 1960.0 | 1910.0 | 2080.0 | 2120.0 | 2100.0 | 2070.0 | 2060.0 |
| Angola | 1590.0 | 1650.0 | 1600.0 | 1240.0 | 1290.0 | 1520.0 | 1760.0 | 1940.0 | 2080.0 | 2190.0 | ... | 6920.0 | 7820.0 | 7750.0 | 7690.0 | 7680.0 | 8040.0 | 8140.0 | 8240.0 | 8040.0 | 7570.0 |
| Albania | 4840.0 | 3510.0 | 3280.0 | 3610.0 | 3930.0 | 4490.0 | 4930.0 | 4420.0 | 4840.0 | 5490.0 | ... | 9180.0 | 9940.0 | 10300.0 | 10800.0 | 11100.0 | 11300.0 | 11400.0 | 11600.0 | 11900.0 | 12300.0 |
| Andorra | 31800.0 | 31300.0 | 30400.0 | 29100.0 | 29000.0 | 29200.0 | 30400.0 | 33200.0 | 34500.0 | 35700.0 | ... | 48600.0 | 46300.0 | 46700.0 | 43600.0 | 46900.0 | 46900.0 | 48900.0 | 50200.0 | 52100.0 | 53900.0 |
| United Arab Emirates | 51100.0 | 50300.0 | 50300.0 | 49800.0 | 52800.0 | 55900.0 | 58300.0 | 62500.0 | 62500.0 | 64300.0 | ... | 76600.0 | 68800.0 | 58400.0 | 54900.0 | 56100.0 | 57400.0 | 59900.0 | 62400.0 | 65200.0 | 66500.0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| Samoa | 4060.0 | 3940.0 | 3890.0 | 4010.0 | 3870.0 | 4100.0 | 4370.0 | 4370.0 | 4450.0 | 4520.0 | ... | 6360.0 | 6380.0 | 6030.0 | 6010.0 | 6210.0 | 5910.0 | 5830.0 | 5790.0 | 6000.0 | 6450.0 |
| Yemen | 4170.0 | 4210.0 | 4320.0 | 4270.0 | 4340.0 | 4400.0 | 4440.0 | 4520.0 | 4650.0 | 4690.0 | ... | 5190.0 | 5230.0 | 5280.0 | 5540.0 | 4700.0 | 4690.0 | 4790.0 | 4660.0 | 3270.0 | 2880.0 |
| South Africa | 10300.0 | 9940.0 | 9490.0 | 9380.0 | 9450.0 | 9540.0 | 9760.0 | 9840.0 | 9730.0 | 9820.0 | ... | 12400.0 | 12600.0 | 12300.0 | 12500.0 | 12700.0 | 12700.0 | 12900.0 | 12900.0 | 12800.0 | 12700.0 |
| Zambia | 2190.0 | 2130.0 | 2050.0 | 2130.0 | 1900.0 | 1910.0 | 1980.0 | 2000.0 | 1930.0 | 1970.0 | ... | 2620.0 | 2750.0 | 2920.0 | 3130.0 | 3200.0 | 3340.0 | 3400.0 | 3450.0 | 3440.0 | 3470.0 |
| Zimbabwe | 3320.0 | 3430.0 | 3060.0 | 3030.0 | 3260.0 | 3230.0 | 3520.0 | 3580.0 | 3650.0 | 3600.0 | ... | 2130.0 | 1740.0 | 1930.0 | 2270.0 | 2560.0 | 2930.0 | 2940.0 | 2960.0 | 2960.0 | 2940.0 |
195 rows × 27 columns
df_Income = df_Income.T # Transposing the columns with the indeces
df_Income
| country | Afghanistan | Angola | Albania | Andorra | United Arab Emirates | Argentina | Armenia | Antigua and Barbuda | Australia | Austria | ... | Uzbekistan | St. Vincent and the Grenadines | Venezuela | Vietnam | Vanuatu | Samoa | Yemen | South Africa | Zambia | Zimbabwe |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1990 | 1110.0 | 1590.0 | 4840.0 | 31800.0 | 51100.0 | 14100.0 | 5180.0 | 15500.0 | 31200.0 | 37600.0 | ... | 3420.0 | 6380.0 | 15200.0 | 1670.0 | 2890.0 | 4060.0 | 4170.0 | 10300.0 | 2190.0 | 3320.0 |
| 1991 | 1010.0 | 1650.0 | 3510.0 | 31300.0 | 50300.0 | 15200.0 | 4620.0 | 15600.0 | 30600.0 | 38500.0 | ... | 3330.0 | 6430.0 | 16400.0 | 1740.0 | 2900.0 | 3940.0 | 4210.0 | 9940.0 | 2130.0 | 3430.0 |
| 1992 | 971.0 | 1600.0 | 3280.0 | 30400.0 | 50300.0 | 16200.0 | 2740.0 | 15500.0 | 30400.0 | 38800.0 | ... | 2890.0 | 6830.0 | 17100.0 | 1850.0 | 2890.0 | 3890.0 | 4320.0 | 9490.0 | 2050.0 | 3060.0 |
| 1993 | 665.0 | 1240.0 | 3610.0 | 29100.0 | 49800.0 | 17300.0 | 2550.0 | 16000.0 | 31300.0 | 38700.0 | ... | 2760.0 | 7120.0 | 16900.0 | 1960.0 | 2830.0 | 4010.0 | 4270.0 | 9380.0 | 2130.0 | 3030.0 |
| 1994 | 493.0 | 1290.0 | 3930.0 | 29000.0 | 52800.0 | 18100.0 | 2760.0 | 16700.0 | 32200.0 | 39500.0 | ... | 2560.0 | 7030.0 | 16300.0 | 2090.0 | 3000.0 | 3870.0 | 4340.0 | 9450.0 | 1900.0 | 3260.0 |
| 1995 | 728.0 | 1520.0 | 4490.0 | 29200.0 | 55900.0 | 17400.0 | 3010.0 | 15600.0 | 33000.0 | 40500.0 | ... | 2490.0 | 7570.0 | 16600.0 | 2250.0 | 2960.0 | 4100.0 | 4400.0 | 9540.0 | 1910.0 | 3230.0 |
| 1996 | 690.0 | 1760.0 | 4930.0 | 30400.0 | 58300.0 | 18100.0 | 3230.0 | 16300.0 | 33900.0 | 41400.0 | ... | 2490.0 | 7670.0 | 16300.0 | 2430.0 | 2960.0 | 4370.0 | 4440.0 | 9760.0 | 1980.0 | 3520.0 |
| 1997 | 656.0 | 1940.0 | 4420.0 | 33200.0 | 62500.0 | 19300.0 | 3380.0 | 16800.0 | 34800.0 | 42200.0 | ... | 2570.0 | 7950.0 | 17100.0 | 2590.0 | 3050.0 | 4370.0 | 4520.0 | 9840.0 | 2000.0 | 3580.0 |
| 1998 | 627.0 | 2080.0 | 4840.0 | 34500.0 | 62500.0 | 19900.0 | 3650.0 | 17300.0 | 36100.0 | 43700.0 | ... | 2640.0 | 8280.0 | 17000.0 | 2700.0 | 3030.0 | 4450.0 | 4650.0 | 9730.0 | 1930.0 | 3650.0 |
| 1999 | 597.0 | 2190.0 | 5490.0 | 35700.0 | 64300.0 | 19000.0 | 3800.0 | 17600.0 | 37500.0 | 45100.0 | ... | 2720.0 | 8510.0 | 15700.0 | 2800.0 | 2990.0 | 4520.0 | 4690.0 | 9820.0 | 1970.0 | 3600.0 |
| 2000 | 578.0 | 2320.0 | 5910.0 | 35400.0 | 71200.0 | 18600.0 | 4050.0 | 18300.0 | 38500.0 | 46600.0 | ... | 2790.0 | 8650.0 | 16100.0 | 2960.0 | 3100.0 | 4810.0 | 4850.0 | 10100.0 | 1990.0 | 3470.0 |
| 2001 | 563.0 | 2490.0 | 6460.0 | 35500.0 | 71800.0 | 17600.0 | 4460.0 | 17200.0 | 38700.0 | 47000.0 | ... | 2870.0 | 8790.0 | 16400.0 | 3110.0 | 2930.0 | 5120.0 | 4890.0 | 10200.0 | 2040.0 | 3510.0 |
| 2002 | 1190.0 | 2900.0 | 6780.0 | 35600.0 | 73000.0 | 15500.0 | 5080.0 | 17100.0 | 39700.0 | 47500.0 | ... | 2940.0 | 9320.0 | 14800.0 | 3270.0 | 2710.0 | 5310.0 | 4940.0 | 10500.0 | 2080.0 | 3190.0 |
| 2003 | 1240.0 | 3120.0 | 7180.0 | 38600.0 | 78100.0 | 16700.0 | 5820.0 | 18000.0 | 40400.0 | 47700.0 | ... | 3030.0 | 10000.0 | 13500.0 | 3460.0 | 2760.0 | 5520.0 | 4980.0 | 10600.0 | 2170.0 | 2640.0 |
| 2004 | 1200.0 | 3520.0 | 7610.0 | 40600.0 | 82000.0 | 18000.0 | 6470.0 | 18700.0 | 41600.0 | 48700.0 | ... | 3220.0 | 10400.0 | 15800.0 | 3690.0 | 2790.0 | 5740.0 | 5030.0 | 11000.0 | 2260.0 | 2480.0 |
| 2005 | 1290.0 | 4270.0 | 8070.0 | 44500.0 | 80200.0 | 19400.0 | 7420.0 | 19700.0 | 42300.0 | 49500.0 | ... | 3410.0 | 10700.0 | 17200.0 | 3930.0 | 2870.0 | 5940.0 | 5160.0 | 11400.0 | 2360.0 | 2330.0 |
| 2006 | 1320.0 | 5560.0 | 8600.0 | 47800.0 | 86400.0 | 20800.0 | 8460.0 | 21900.0 | 42900.0 | 50900.0 | ... | 3620.0 | 11500.0 | 18700.0 | 4170.0 | 3040.0 | 6020.0 | 5170.0 | 11900.0 | 2480.0 | 2230.0 |
| 2007 | 1460.0 | 6920.0 | 9180.0 | 48600.0 | 76600.0 | 22400.0 | 9710.0 | 23500.0 | 44300.0 | 52700.0 | ... | 3900.0 | 11900.0 | 20000.0 | 4420.0 | 3120.0 | 6360.0 | 5190.0 | 12400.0 | 2620.0 | 2130.0 |
| 2008 | 1480.0 | 7820.0 | 9940.0 | 46300.0 | 68800.0 | 23100.0 | 10500.0 | 23100.0 | 45000.0 | 53300.0 | ... | 4190.0 | 12100.0 | 20700.0 | 4630.0 | 3240.0 | 6380.0 | 5230.0 | 12600.0 | 2750.0 | 1740.0 |
| 2009 | 1760.0 | 7750.0 | 10300.0 | 46700.0 | 58400.0 | 21500.0 | 9050.0 | 20000.0 | 44900.0 | 51100.0 | ... | 4450.0 | 11800.0 | 19800.0 | 4830.0 | 3270.0 | 6030.0 | 5280.0 | 12300.0 | 2920.0 | 1930.0 |
| 2010 | 1960.0 | 7690.0 | 10800.0 | 43600.0 | 54900.0 | 23500.0 | 9290.0 | 18200.0 | 45100.0 | 51900.0 | ... | 4650.0 | 11400.0 | 19700.0 | 5090.0 | 3240.0 | 6010.0 | 5540.0 | 12500.0 | 3130.0 | 2270.0 |
| 2011 | 1910.0 | 7680.0 | 11100.0 | 46900.0 | 56100.0 | 24600.0 | 9730.0 | 17600.0 | 45600.0 | 53300.0 | ... | 4880.0 | 11400.0 | 20400.0 | 5350.0 | 3190.0 | 6210.0 | 4700.0 | 12700.0 | 3200.0 | 2560.0 |
| 2012 | 2080.0 | 8040.0 | 11300.0 | 46900.0 | 57400.0 | 24100.0 | 10400.0 | 18000.0 | 46600.0 | 53400.0 | ... | 5160.0 | 11500.0 | 21300.0 | 5570.0 | 3160.0 | 5910.0 | 4690.0 | 12700.0 | 3340.0 | 2930.0 |
| 2013 | 2120.0 | 8140.0 | 11400.0 | 48900.0 | 59900.0 | 24400.0 | 10700.0 | 17600.0 | 47000.0 | 53100.0 | ... | 5470.0 | 11700.0 | 24600.0 | 5820.0 | 3130.0 | 5830.0 | 4790.0 | 12900.0 | 3400.0 | 2940.0 |
| 2014 | 2100.0 | 8240.0 | 11600.0 | 50200.0 | 62400.0 | 23600.0 | 11000.0 | 18100.0 | 47400.0 | 53000.0 | ... | 5760.0 | 11800.0 | 23400.0 | 6100.0 | 3120.0 | 5790.0 | 4660.0 | 12900.0 | 3450.0 | 2960.0 |
| 2015 | 2070.0 | 8040.0 | 11900.0 | 52100.0 | 65200.0 | 23900.0 | 11300.0 | 18600.0 | 47800.0 | 53000.0 | ... | 6090.0 | 12000.0 | 21600.0 | 6440.0 | 3040.0 | 6000.0 | 3270.0 | 12800.0 | 3440.0 | 2960.0 |
| 2016 | 2060.0 | 7570.0 | 12300.0 | 53900.0 | 66500.0 | 23200.0 | 11300.0 | 19400.0 | 48300.0 | 53400.0 | ... | 6350.0 | 12200.0 | 17500.0 | 6770.0 | 3060.0 | 6450.0 | 2880.0 | 12700.0 | 3470.0 | 2940.0 |
27 rows × 195 columns
df_Income.columns.rename(name="Years",inplace=True)
df_Income
| Years | Afghanistan | Angola | Albania | Andorra | United Arab Emirates | Argentina | Armenia | Antigua and Barbuda | Australia | Austria | ... | Uzbekistan | St. Vincent and the Grenadines | Venezuela | Vietnam | Vanuatu | Samoa | Yemen | South Africa | Zambia | Zimbabwe |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1990 | 1110.0 | 1590.0 | 4840.0 | 31800.0 | 51100.0 | 14100.0 | 5180.0 | 15500.0 | 31200.0 | 37600.0 | ... | 3420.0 | 6380.0 | 15200.0 | 1670.0 | 2890.0 | 4060.0 | 4170.0 | 10300.0 | 2190.0 | 3320.0 |
| 1991 | 1010.0 | 1650.0 | 3510.0 | 31300.0 | 50300.0 | 15200.0 | 4620.0 | 15600.0 | 30600.0 | 38500.0 | ... | 3330.0 | 6430.0 | 16400.0 | 1740.0 | 2900.0 | 3940.0 | 4210.0 | 9940.0 | 2130.0 | 3430.0 |
| 1992 | 971.0 | 1600.0 | 3280.0 | 30400.0 | 50300.0 | 16200.0 | 2740.0 | 15500.0 | 30400.0 | 38800.0 | ... | 2890.0 | 6830.0 | 17100.0 | 1850.0 | 2890.0 | 3890.0 | 4320.0 | 9490.0 | 2050.0 | 3060.0 |
| 1993 | 665.0 | 1240.0 | 3610.0 | 29100.0 | 49800.0 | 17300.0 | 2550.0 | 16000.0 | 31300.0 | 38700.0 | ... | 2760.0 | 7120.0 | 16900.0 | 1960.0 | 2830.0 | 4010.0 | 4270.0 | 9380.0 | 2130.0 | 3030.0 |
| 1994 | 493.0 | 1290.0 | 3930.0 | 29000.0 | 52800.0 | 18100.0 | 2760.0 | 16700.0 | 32200.0 | 39500.0 | ... | 2560.0 | 7030.0 | 16300.0 | 2090.0 | 3000.0 | 3870.0 | 4340.0 | 9450.0 | 1900.0 | 3260.0 |
| 1995 | 728.0 | 1520.0 | 4490.0 | 29200.0 | 55900.0 | 17400.0 | 3010.0 | 15600.0 | 33000.0 | 40500.0 | ... | 2490.0 | 7570.0 | 16600.0 | 2250.0 | 2960.0 | 4100.0 | 4400.0 | 9540.0 | 1910.0 | 3230.0 |
| 1996 | 690.0 | 1760.0 | 4930.0 | 30400.0 | 58300.0 | 18100.0 | 3230.0 | 16300.0 | 33900.0 | 41400.0 | ... | 2490.0 | 7670.0 | 16300.0 | 2430.0 | 2960.0 | 4370.0 | 4440.0 | 9760.0 | 1980.0 | 3520.0 |
| 1997 | 656.0 | 1940.0 | 4420.0 | 33200.0 | 62500.0 | 19300.0 | 3380.0 | 16800.0 | 34800.0 | 42200.0 | ... | 2570.0 | 7950.0 | 17100.0 | 2590.0 | 3050.0 | 4370.0 | 4520.0 | 9840.0 | 2000.0 | 3580.0 |
| 1998 | 627.0 | 2080.0 | 4840.0 | 34500.0 | 62500.0 | 19900.0 | 3650.0 | 17300.0 | 36100.0 | 43700.0 | ... | 2640.0 | 8280.0 | 17000.0 | 2700.0 | 3030.0 | 4450.0 | 4650.0 | 9730.0 | 1930.0 | 3650.0 |
| 1999 | 597.0 | 2190.0 | 5490.0 | 35700.0 | 64300.0 | 19000.0 | 3800.0 | 17600.0 | 37500.0 | 45100.0 | ... | 2720.0 | 8510.0 | 15700.0 | 2800.0 | 2990.0 | 4520.0 | 4690.0 | 9820.0 | 1970.0 | 3600.0 |
| 2000 | 578.0 | 2320.0 | 5910.0 | 35400.0 | 71200.0 | 18600.0 | 4050.0 | 18300.0 | 38500.0 | 46600.0 | ... | 2790.0 | 8650.0 | 16100.0 | 2960.0 | 3100.0 | 4810.0 | 4850.0 | 10100.0 | 1990.0 | 3470.0 |
| 2001 | 563.0 | 2490.0 | 6460.0 | 35500.0 | 71800.0 | 17600.0 | 4460.0 | 17200.0 | 38700.0 | 47000.0 | ... | 2870.0 | 8790.0 | 16400.0 | 3110.0 | 2930.0 | 5120.0 | 4890.0 | 10200.0 | 2040.0 | 3510.0 |
| 2002 | 1190.0 | 2900.0 | 6780.0 | 35600.0 | 73000.0 | 15500.0 | 5080.0 | 17100.0 | 39700.0 | 47500.0 | ... | 2940.0 | 9320.0 | 14800.0 | 3270.0 | 2710.0 | 5310.0 | 4940.0 | 10500.0 | 2080.0 | 3190.0 |
| 2003 | 1240.0 | 3120.0 | 7180.0 | 38600.0 | 78100.0 | 16700.0 | 5820.0 | 18000.0 | 40400.0 | 47700.0 | ... | 3030.0 | 10000.0 | 13500.0 | 3460.0 | 2760.0 | 5520.0 | 4980.0 | 10600.0 | 2170.0 | 2640.0 |
| 2004 | 1200.0 | 3520.0 | 7610.0 | 40600.0 | 82000.0 | 18000.0 | 6470.0 | 18700.0 | 41600.0 | 48700.0 | ... | 3220.0 | 10400.0 | 15800.0 | 3690.0 | 2790.0 | 5740.0 | 5030.0 | 11000.0 | 2260.0 | 2480.0 |
| 2005 | 1290.0 | 4270.0 | 8070.0 | 44500.0 | 80200.0 | 19400.0 | 7420.0 | 19700.0 | 42300.0 | 49500.0 | ... | 3410.0 | 10700.0 | 17200.0 | 3930.0 | 2870.0 | 5940.0 | 5160.0 | 11400.0 | 2360.0 | 2330.0 |
| 2006 | 1320.0 | 5560.0 | 8600.0 | 47800.0 | 86400.0 | 20800.0 | 8460.0 | 21900.0 | 42900.0 | 50900.0 | ... | 3620.0 | 11500.0 | 18700.0 | 4170.0 | 3040.0 | 6020.0 | 5170.0 | 11900.0 | 2480.0 | 2230.0 |
| 2007 | 1460.0 | 6920.0 | 9180.0 | 48600.0 | 76600.0 | 22400.0 | 9710.0 | 23500.0 | 44300.0 | 52700.0 | ... | 3900.0 | 11900.0 | 20000.0 | 4420.0 | 3120.0 | 6360.0 | 5190.0 | 12400.0 | 2620.0 | 2130.0 |
| 2008 | 1480.0 | 7820.0 | 9940.0 | 46300.0 | 68800.0 | 23100.0 | 10500.0 | 23100.0 | 45000.0 | 53300.0 | ... | 4190.0 | 12100.0 | 20700.0 | 4630.0 | 3240.0 | 6380.0 | 5230.0 | 12600.0 | 2750.0 | 1740.0 |
| 2009 | 1760.0 | 7750.0 | 10300.0 | 46700.0 | 58400.0 | 21500.0 | 9050.0 | 20000.0 | 44900.0 | 51100.0 | ... | 4450.0 | 11800.0 | 19800.0 | 4830.0 | 3270.0 | 6030.0 | 5280.0 | 12300.0 | 2920.0 | 1930.0 |
| 2010 | 1960.0 | 7690.0 | 10800.0 | 43600.0 | 54900.0 | 23500.0 | 9290.0 | 18200.0 | 45100.0 | 51900.0 | ... | 4650.0 | 11400.0 | 19700.0 | 5090.0 | 3240.0 | 6010.0 | 5540.0 | 12500.0 | 3130.0 | 2270.0 |
| 2011 | 1910.0 | 7680.0 | 11100.0 | 46900.0 | 56100.0 | 24600.0 | 9730.0 | 17600.0 | 45600.0 | 53300.0 | ... | 4880.0 | 11400.0 | 20400.0 | 5350.0 | 3190.0 | 6210.0 | 4700.0 | 12700.0 | 3200.0 | 2560.0 |
| 2012 | 2080.0 | 8040.0 | 11300.0 | 46900.0 | 57400.0 | 24100.0 | 10400.0 | 18000.0 | 46600.0 | 53400.0 | ... | 5160.0 | 11500.0 | 21300.0 | 5570.0 | 3160.0 | 5910.0 | 4690.0 | 12700.0 | 3340.0 | 2930.0 |
| 2013 | 2120.0 | 8140.0 | 11400.0 | 48900.0 | 59900.0 | 24400.0 | 10700.0 | 17600.0 | 47000.0 | 53100.0 | ... | 5470.0 | 11700.0 | 24600.0 | 5820.0 | 3130.0 | 5830.0 | 4790.0 | 12900.0 | 3400.0 | 2940.0 |
| 2014 | 2100.0 | 8240.0 | 11600.0 | 50200.0 | 62400.0 | 23600.0 | 11000.0 | 18100.0 | 47400.0 | 53000.0 | ... | 5760.0 | 11800.0 | 23400.0 | 6100.0 | 3120.0 | 5790.0 | 4660.0 | 12900.0 | 3450.0 | 2960.0 |
| 2015 | 2070.0 | 8040.0 | 11900.0 | 52100.0 | 65200.0 | 23900.0 | 11300.0 | 18600.0 | 47800.0 | 53000.0 | ... | 6090.0 | 12000.0 | 21600.0 | 6440.0 | 3040.0 | 6000.0 | 3270.0 | 12800.0 | 3440.0 | 2960.0 |
| 2016 | 2060.0 | 7570.0 | 12300.0 | 53900.0 | 66500.0 | 23200.0 | 11300.0 | 19400.0 | 48300.0 | 53400.0 | ... | 6350.0 | 12200.0 | 17500.0 | 6770.0 | 3060.0 | 6450.0 | 2880.0 | 12700.0 | 3470.0 | 2940.0 |
27 rows × 195 columns
df_Unemployment.set_index("Country",inplace=True)
df_Unemployment = df_Unemployment.T
df_Unemployment.columns.rename(name="Years",inplace=True)
df_Unemployment
| Years | Aruba | Africa Eastern and Southern | Afghanistan | Africa Western and Central | Angola | Albania | Andorra | Arab World | United Arab Emirates | Argentina | ... | Virgin Islands (U.S.) | Vietnam | Vanuatu | World | Samoa | Kosovo | Yemen, Rep. | South Africa | Zambia | Zimbabwe |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1990 | 0.0 | 0.000000 | 0.000 | 0.000000 | 0.000 | 0.000000 | 0.0 | 0.000000 | 0.000 | 0.000000 | ... | 0.000 | 0.000 | 0.000 | 0.000000 | 0.000 | 0.0 | 0.000 | 0.000000 | 0.000000 | 0.000 |
| 1991 | 0.0 | 7.797012 | 10.649 | 4.415455 | 4.208 | 10.307000 | 0.0 | 11.624660 | 1.866 | 5.440000 | ... | 12.351 | 2.092 | 1.676 | 4.799869 | 2.100 | 0.0 | 8.318 | 29.955000 | 18.900000 | 4.941 |
| 1992 | 0.0 | 7.838142 | 10.821 | 4.530574 | 4.208 | 30.014999 | 0.0 | 12.123597 | 1.842 | 6.360000 | ... | 12.511 | 1.912 | 1.692 | 4.962862 | 2.384 | 0.0 | 8.310 | 29.980000 | 19.370001 | 4.993 |
| 1993 | 0.0 | 7.849445 | 10.723 | 4.546265 | 4.231 | 25.257999 | 0.0 | 12.859821 | 1.849 | 10.100000 | ... | 12.703 | 1.969 | 1.734 | 5.230848 | 2.631 | 0.0 | 8.355 | 29.922001 | 19.700001 | 4.974 |
| 1994 | 0.0 | 7.839701 | 10.726 | 4.539152 | 4.162 | 20.840000 | 0.0 | 12.949263 | 1.806 | 11.760000 | ... | 12.469 | 1.931 | 1.592 | 5.486189 | 3.035 | 0.0 | 8.340 | 29.889000 | 18.426001 | 4.960 |
| 1995 | 0.0 | 7.833286 | 11.179 | 4.525745 | 4.114 | 14.611000 | 0.0 | 13.317197 | 1.800 | 18.799999 | ... | 12.133 | 1.899 | 1.742 | 5.625571 | 3.187 | 0.0 | 8.964 | 29.893999 | 16.806000 | 5.633 |
| 1996 | 0.0 | 7.841857 | 10.962 | 4.566774 | 4.097 | 13.931000 | 0.0 | 12.382483 | 1.900 | 17.110001 | ... | 12.210 | 1.930 | 1.724 | 5.700035 | 3.474 | 0.0 | 9.590 | 29.874001 | 15.300000 | 6.251 |
| 1997 | 0.0 | 7.858703 | 10.783 | 4.602367 | 4.088 | 16.875999 | 0.0 | 11.948039 | 1.980 | 14.820000 | ... | 12.121 | 2.870 | 1.684 | 5.703384 | 3.903 | 0.0 | 10.201 | 29.907000 | 13.644000 | 6.930 |
| 1998 | 0.0 | 7.810903 | 10.802 | 4.662650 | 4.072 | 20.047001 | 0.0 | 11.969959 | 2.137 | 12.650000 | ... | 11.862 | 2.290 | 1.760 | 5.857247 | 4.175 | 0.0 | 10.812 | 29.947001 | 12.000000 | 6.460 |
| 1999 | 0.0 | 7.789680 | 10.809 | 4.863700 | 4.055 | 20.840000 | 0.0 | 12.109096 | 2.216 | 14.050000 | ... | 11.497 | 2.330 | 1.784 | 5.969774 | 4.480 | 0.0 | 11.460 | 29.913000 | 12.441000 | 6.000 |
| 2000 | 0.0 | 7.724844 | 10.806 | 4.921423 | 4.030 | 19.028000 | 0.0 | 12.596101 | 2.250 | 15.000000 | ... | 11.109 | 2.260 | 1.687 | 5.769081 | 4.664 | 0.0 | 11.558 | 29.879999 | 12.930000 | 5.688 |
| 2001 | 0.0 | 7.732945 | 10.809 | 4.865752 | 4.004 | 18.575001 | 0.0 | 12.469380 | 2.493 | 17.320000 | ... | 11.083 | 2.760 | 1.875 | 5.856253 | 4.960 | 0.0 | 11.714 | 30.690001 | 13.509000 | 5.355 |
| 2002 | 0.0 | 7.959582 | 11.257 | 4.781385 | 3.961 | 17.895000 | 0.0 | 12.465001 | 2.648 | 19.590000 | ... | 11.195 | 2.120 | 1.921 | 6.074849 | 5.096 | 0.0 | 11.840 | 33.290001 | 14.118000 | 5.062 |
| 2003 | 0.0 | 7.787965 | 11.141 | 4.751168 | 3.958 | 16.989000 | 0.0 | 12.390521 | 2.751 | 15.360000 | ... | 11.364 | 2.250 | 1.738 | 6.164370 | 5.156 | 0.0 | 11.971 | 32.310001 | 14.695000 | 4.750 |
| 2004 | 0.0 | 7.310328 | 10.988 | 4.731880 | 3.916 | 16.309999 | 0.0 | 11.352673 | 2.907 | 13.520000 | ... | 11.048 | 2.140 | 1.751 | 6.001752 | 5.217 | 0.0 | 12.097 | 29.450001 | 15.298000 | 4.390 |
| 2005 | 0.0 | 7.117658 | 11.217 | 4.727947 | 3.882 | 15.970000 | 0.0 | 11.195937 | 3.120 | 11.510000 | ... | 10.964 | 2.095 | 1.734 | 5.898290 | 5.294 | 0.0 | 12.206 | 29.120001 | 15.900000 | 4.538 |
| 2006 | 0.0 | 6.989477 | 11.099 | 4.648872 | 3.858 | 15.630000 | 0.0 | 10.425838 | 2.937 | 10.080000 | ... | 10.411 | 2.087 | 1.684 | 5.632652 | 5.422 | 0.0 | 12.366 | 28.340000 | 13.245000 | 4.681 |
| 2007 | 0.0 | 6.738765 | 11.301 | 4.627661 | 3.821 | 15.970000 | 0.0 | 10.027224 | 2.872 | 8.470000 | ... | 10.191 | 2.030 | 1.795 | 5.416889 | 5.360 | 0.0 | 12.494 | 26.540001 | 10.587000 | 4.829 |
| 2008 | 0.0 | 6.271977 | 11.093 | 4.599393 | 3.793 | 13.060000 | 0.0 | 9.724742 | 2.737 | 7.840000 | ... | 10.308 | 1.927 | 1.751 | 5.410319 | 5.581 | 0.0 | 12.621 | 22.410000 | 7.930000 | 5.014 |
| 2009 | 0.0 | 6.323909 | 11.311 | 4.583291 | 3.780 | 13.670000 | 0.0 | 9.329220 | 2.679 | 8.650000 | ... | 11.584 | 1.740 | 1.808 | 6.005676 | 5.828 | 0.0 | 12.749 | 23.520000 | 10.558000 | 5.083 |
| 2010 | 0.0 | 6.867786 | 11.352 | 4.554662 | 9.430 | 14.090000 | 0.0 | 9.400912 | 2.481 | 7.710000 | ... | 11.734 | 1.110 | 1.850 | 5.902056 | 5.728 | 0.0 | 12.831 | 24.680000 | 13.190000 | 5.209 |
| 2011 | 0.0 | 6.748081 | 11.054 | 4.548376 | 7.360 | 13.480000 | 0.0 | 10.476673 | 2.302 | 7.180000 | ... | 12.080 | 1.000 | 1.811 | 5.765093 | 5.680 | 0.0 | 13.235 | 24.639999 | 10.551000 | 5.370 |
| 2012 | 0.0 | 6.562179 | 11.341 | 4.637602 | 7.347 | 13.380000 | 0.0 | 10.663129 | 2.185 | 7.220000 | ... | 12.231 | 1.030 | 1.852 | 5.737713 | 8.750 | 0.0 | 13.167 | 24.730000 | 7.850000 | 5.153 |
| 2013 | 0.0 | 6.445456 | 11.193 | 4.410216 | 7.366 | 15.870000 | 0.0 | 10.735393 | 2.044 | 7.100000 | ... | 12.755 | 1.320 | 1.862 | 5.727649 | 8.667 | 0.0 | 13.268 | 24.559999 | 8.611000 | 4.982 |
| 2014 | 0.0 | 6.405195 | 11.142 | 4.688088 | 7.372 | 18.049999 | 0.0 | 10.872227 | 1.911 | 7.270000 | ... | 12.791 | 1.260 | 1.808 | 5.603743 | 8.720 | 0.0 | 13.470 | 24.889999 | 9.362000 | 4.770 |
| 2015 | 0.0 | 6.490041 | 11.127 | 4.626737 | 7.392 | 17.190001 | 0.0 | 10.965901 | 1.768 | 7.521000 | ... | 12.617 | 1.850 | 1.862 | 5.620230 | 8.501 | 0.0 | 13.770 | 25.150000 | 10.125000 | 4.778 |
| 2016 | 0.0 | 6.610205 | 11.158 | 5.567017 | 7.412 | 15.420000 | 0.0 | 10.761115 | 1.640 | 8.111000 | ... | 12.677 | 1.850 | 1.776 | 5.656575 | 8.307 | 0.0 | 13.433 | 26.540001 | 10.872000 | 4.788 |
27 rows × 266 columns
df_Population.set_index("country", inplace = True)
df_Population = df_Population.T
df_Population.columns.rename(name="Years",inplace=True)
df_Population
| Years | Afghanistan | Angola | Albania | Andorra | United Arab Emirates | Argentina | Armenia | Antigua and Barbuda | Australia | Austria | ... | Uzbekistan | St. Vincent and the Grenadines | Venezuela | Vietnam | Vanuatu | Samoa | Yemen | South Africa | Zambia | Zimbabwe |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1990 | 12400000.0 | 11800000.0 | 3290000.0 | 54500.0 | 1830000.0 | 32600000.0 | 3540000.0 | 62500.0 | 17000000.0 | 7720000.0 | ... | 20400000.0 | 107000.0 | 19600000.0 | 68000000.0 | 147000.0 | 163000.0 | 11700000.0 | 36800000.0 | 8040000.0 | 10400000.0 |
| 1991 | 13300000.0 | 12200000.0 | 3280000.0 | 56700.0 | 1940000.0 | 33100000.0 | 3510000.0 | 63400.0 | 17200000.0 | 7770000.0 | ... | 20900000.0 | 108000.0 | 20100000.0 | 69400000.0 | 151000.0 | 164000.0 | 12300000.0 | 37700000.0 | 8250000.0 | 10700000.0 |
| 1992 | 14500000.0 | 12700000.0 | 3250000.0 | 58900.0 | 2050000.0 | 33500000.0 | 3440000.0 | 64500.0 | 17400000.0 | 7830000.0 | ... | 21400000.0 | 108000.0 | 20600000.0 | 70900000.0 | 155000.0 | 165000.0 | 13000000.0 | 38700000.0 | 8450000.0 | 10900000.0 |
| 1993 | 15800000.0 | 13100000.0 | 3200000.0 | 61000.0 | 2170000.0 | 34000000.0 | 3360000.0 | 65800.0 | 17600000.0 | 7890000.0 | ... | 21900000.0 | 108000.0 | 21000000.0 | 72300000.0 | 160000.0 | 167000.0 | 13600000.0 | 39600000.0 | 8660000.0 | 11100000.0 |
| 1994 | 17100000.0 | 13500000.0 | 3150000.0 | 62700.0 | 2290000.0 | 34400000.0 | 3280000.0 | 67200.0 | 17800000.0 | 7950000.0 | ... | 22300000.0 | 108000.0 | 21500000.0 | 73700000.0 | 164000.0 | 169000.0 | 14300000.0 | 40600000.0 | 8870000.0 | 11300000.0 |
| 1995 | 18100000.0 | 13900000.0 | 3110000.0 | 63900.0 | 2420000.0 | 34800000.0 | 3220000.0 | 68700.0 | 18000000.0 | 7990000.0 | ... | 22800000.0 | 108000.0 | 21900000.0 | 74900000.0 | 168000.0 | 170000.0 | 14900000.0 | 41400000.0 | 9100000.0 | 11400000.0 |
| 1996 | 18900000.0 | 14400000.0 | 3100000.0 | 64400.0 | 2540000.0 | 35200000.0 | 3170000.0 | 70200.0 | 18200000.0 | 8020000.0 | ... | 23200000.0 | 108000.0 | 22400000.0 | 76100000.0 | 172000.0 | 171000.0 | 15500000.0 | 42200000.0 | 9340000.0 | 11500000.0 |
| 1997 | 19400000.0 | 14900000.0 | 3100000.0 | 64300.0 | 2670000.0 | 35700000.0 | 3130000.0 | 71700.0 | 18400000.0 | 8030000.0 | ... | 23600000.0 | 108000.0 | 22800000.0 | 77100000.0 | 175000.0 | 172000.0 | 16000000.0 | 43000000.0 | 9600000.0 | 11700000.0 |
| 1998 | 19700000.0 | 15400000.0 | 3110000.0 | 64100.0 | 2810000.0 | 36100000.0 | 3110000.0 | 73200.0 | 18600000.0 | 8040000.0 | ... | 24000000.0 | 108000.0 | 23300000.0 | 78100000.0 | 178000.0 | 173000.0 | 16500000.0 | 43700000.0 | 9870000.0 | 11700000.0 |
| 1999 | 20200000.0 | 15900000.0 | 3120000.0 | 64400.0 | 2970000.0 | 36500000.0 | 3090000.0 | 74700.0 | 18800000.0 | 8050000.0 | ... | 24400000.0 | 108000.0 | 23700000.0 | 79000000.0 | 181000.0 | 174000.0 | 16900000.0 | 44300000.0 | 10100000.0 | 11800000.0 |
| 2000 | 20800000.0 | 16400000.0 | 3130000.0 | 65400.0 | 3130000.0 | 36900000.0 | 3070000.0 | 76000.0 | 19000000.0 | 8070000.0 | ... | 24800000.0 | 108000.0 | 24200000.0 | 79900000.0 | 185000.0 | 174000.0 | 17400000.0 | 45000000.0 | 10400000.0 | 11900000.0 |
| 2001 | 21600000.0 | 16900000.0 | 3130000.0 | 67300.0 | 3300000.0 | 37300000.0 | 3050000.0 | 77200.0 | 19200000.0 | 8100000.0 | ... | 25100000.0 | 108000.0 | 24600000.0 | 80700000.0 | 189000.0 | 175000.0 | 17900000.0 | 45600000.0 | 10700000.0 | 11900000.0 |
| 2002 | 22600000.0 | 17500000.0 | 3130000.0 | 70000.0 | 3480000.0 | 37700000.0 | 3030000.0 | 78300.0 | 19400000.0 | 8130000.0 | ... | 25400000.0 | 108000.0 | 25100000.0 | 81500000.0 | 194000.0 | 176000.0 | 18400000.0 | 46200000.0 | 11000000.0 | 12000000.0 |
| 2003 | 23700000.0 | 18100000.0 | 3120000.0 | 73200.0 | 3710000.0 | 38100000.0 | 3020000.0 | 79300.0 | 19600000.0 | 8180000.0 | ... | 25700000.0 | 108000.0 | 25600000.0 | 82300000.0 | 199000.0 | 177000.0 | 19000000.0 | 46700000.0 | 11300000.0 | 12000000.0 |
| 2004 | 24700000.0 | 18800000.0 | 3100000.0 | 76300.0 | 4070000.0 | 38500000.0 | 3000000.0 | 80300.0 | 19900000.0 | 8220000.0 | ... | 26100000.0 | 109000.0 | 26000000.0 | 83100000.0 | 204000.0 | 179000.0 | 19500000.0 | 47300000.0 | 11600000.0 | 12000000.0 |
| 2005 | 25700000.0 | 19400000.0 | 3090000.0 | 78900.0 | 4590000.0 | 38900000.0 | 2980000.0 | 81500.0 | 20200000.0 | 8250000.0 | ... | 26400000.0 | 109000.0 | 26400000.0 | 83800000.0 | 209000.0 | 180000.0 | 20100000.0 | 47900000.0 | 11900000.0 | 12100000.0 |
| 2006 | 26400000.0 | 20100000.0 | 3060000.0 | 81000.0 | 5300000.0 | 39300000.0 | 2960000.0 | 82700.0 | 20500000.0 | 8290000.0 | ... | 26800000.0 | 109000.0 | 26900000.0 | 84600000.0 | 214000.0 | 181000.0 | 20700000.0 | 48500000.0 | 12200000.0 | 12200000.0 |
| 2007 | 27100000.0 | 20900000.0 | 3030000.0 | 82700.0 | 6170000.0 | 39700000.0 | 2930000.0 | 84000.0 | 20900000.0 | 8310000.0 | ... | 27200000.0 | 109000.0 | 27200000.0 | 85400000.0 | 219000.0 | 182000.0 | 21300000.0 | 49100000.0 | 12500000.0 | 12300000.0 |
| 2008 | 27700000.0 | 21700000.0 | 3000000.0 | 83900.0 | 7090000.0 | 40100000.0 | 2910000.0 | 85400.0 | 21300000.0 | 8340000.0 | ... | 27600000.0 | 108000.0 | 27600000.0 | 86200000.0 | 225000.0 | 183000.0 | 21900000.0 | 49800000.0 | 12800000.0 | 12400000.0 |
| 2009 | 28400000.0 | 22500000.0 | 2970000.0 | 84500.0 | 7920000.0 | 40500000.0 | 2890000.0 | 86700.0 | 21800000.0 | 8370000.0 | ... | 28100000.0 | 108000.0 | 28000000.0 | 87100000.0 | 230000.0 | 185000.0 | 22500000.0 | 50500000.0 | 13200000.0 | 12500000.0 |
| 2010 | 29200000.0 | 23400000.0 | 2950000.0 | 84500.0 | 8550000.0 | 40900000.0 | 2880000.0 | 88000.0 | 22200000.0 | 8410000.0 | ... | 28500000.0 | 108000.0 | 28400000.0 | 88000000.0 | 236000.0 | 186000.0 | 23200000.0 | 51200000.0 | 13600000.0 | 12700000.0 |
| 2011 | 30100000.0 | 24200000.0 | 2930000.0 | 83700.0 | 8950000.0 | 41300000.0 | 2880000.0 | 89300.0 | 22500000.0 | 8450000.0 | ... | 29000000.0 | 108000.0 | 28900000.0 | 88900000.0 | 243000.0 | 187000.0 | 23800000.0 | 52000000.0 | 14000000.0 | 12900000.0 |
| 2012 | 31200000.0 | 25100000.0 | 2910000.0 | 82400.0 | 9140000.0 | 41800000.0 | 2880000.0 | 90400.0 | 22900000.0 | 8500000.0 | ... | 29400000.0 | 108000.0 | 29400000.0 | 89800000.0 | 250000.0 | 189000.0 | 24500000.0 | 52800000.0 | 14500000.0 | 13100000.0 |
| 2013 | 32300000.0 | 26000000.0 | 2900000.0 | 80800.0 | 9200000.0 | 42200000.0 | 2900000.0 | 91500.0 | 23300000.0 | 8560000.0 | ... | 29900000.0 | 109000.0 | 29800000.0 | 90800000.0 | 257000.0 | 191000.0 | 25100000.0 | 53700000.0 | 14900000.0 | 13400000.0 |
| 2014 | 33400000.0 | 26900000.0 | 2900000.0 | 79200.0 | 9210000.0 | 42600000.0 | 2910000.0 | 92600.0 | 23600000.0 | 8620000.0 | ... | 30400000.0 | 109000.0 | 30000000.0 | 91700000.0 | 264000.0 | 192000.0 | 25800000.0 | 54500000.0 | 15400000.0 | 13600000.0 |
| 2015 | 34400000.0 | 27900000.0 | 2890000.0 | 78000.0 | 9260000.0 | 43100000.0 | 2930000.0 | 93600.0 | 23900000.0 | 8680000.0 | ... | 30900000.0 | 109000.0 | 30100000.0 | 92700000.0 | 271000.0 | 194000.0 | 26500000.0 | 55400000.0 | 15900000.0 | 13800000.0 |
| 2016 | 35400000.0 | 28800000.0 | 2890000.0 | 77300.0 | 9360000.0 | 43500000.0 | 2940000.0 | 94500.0 | 24300000.0 | 8750000.0 | ... | 31400000.0 | 109000.0 | 29900000.0 | 93600000.0 | 278000.0 | 195000.0 | 27200000.0 | 56200000.0 | 16400000.0 | 14000000.0 |
27 rows × 197 columns
plt.figure(figsize=(15,10), dpi= 65)
plt.vlines(x=comparing_Egypt_Murder.index, ymin=0, ymax=comparing_Egypt_Murder.values,label='Egypt',color="#66995A")
for x, y in zip(comparing_Egypt_Murder.index, comparing_Egypt_Murder.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'red' if y > 1.2 else '#098003', 'size':14})
plt.plot(comparing_Egypt_Murder.index, comparing_Egypt_Murder.values,'o--', color='#1A1429', alpha=0.5)
# Decorations
# plt.yticks(df.index, df.cars, fontsize=12)
# plt.xlim(-2.5, 2.5)
plt.grid(axis = 'y', linestyle=':', alpha=1,color = 'black')
title_size = 18
plt.title("Egypt Murder Rate" ,fontsize=title_size)
plt.legend(loc="upper left",fontsize= 15)
plt.ylabel("Rate",fontsize=title_size)
plt.xlabel("Years", fontsize=title_size)
plt.tick_params(labelsize=16,length=0)
plt.tight_layout()
plt.show()
Average_Egypt_Murder = (0.83 + 1.04 + 1.3 + 1.33)/ 4
Average_Egypt_Murder
1.125
murder_ratio.Egypt.describe()
count 27.000000 mean 1.029824 std 0.218151 min 0.798995 25% 0.818540 50% 0.953052 75% 1.301601 max 1.326180 Name: Egypt, dtype: float64
comparing_Japan_Murder = Comparing(murder_ratio.Japan)
plt.figure(figsize=(15,10), dpi= 65)
plt.vlines(x=comparing_Japan_Murder.index, ymin=0, ymax=comparing_Japan_Murder.values,label='Japan',color="#4D2403")
for x, y in zip(comparing_Japan_Murder.index, comparing_Japan_Murder.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#c91a22' if y > 2.5 else '#098003', 'size':14})
plt.plot(comparing_Japan_Murder.index, comparing_Japan_Murder.values,'o--', color='#BA631C', alpha=0.5)
plt.grid(axis = 'y', linestyle=':', alpha=1,color = 'black')
title_size = 18
plt.title("Japan Murder Rate" ,fontsize=title_size)
plt.legend(loc="upper right",fontsize= 15)
plt.ylabel("Rate",fontsize=title_size)
plt.xlabel("Years", fontsize=title_size)
plt.tick_params(labelsize=16,length=0)
plt.tight_layout()
plt.show()
Average_Japan_Murder = (3.5 + 2.79 + 2.13 + 1.64)/ 4
Average_Japan_Murder
2.515
murder_ratio.Japan.describe()
count 27.000000 mean 3.084479 std 1.011557 min 1.637475 25% 2.182900 50% 3.083573 75% 3.845321 max 4.894515 Name: Japan, dtype: float64
comparing_Russia_Murder = Comparing(murder_ratio.Russia)
plt.figure(figsize=(15,10), dpi= 65)
plt.vlines(x=comparing_Russia_Murder.index, ymin=0, ymax=comparing_Russia_Murder.values,label='Russia',color="#6010BB")
for x, y in zip(comparing_Russia_Murder.index, comparing_Russia_Murder.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#c91a22' if y > 150 else '#098003', 'size':14})
plt.plot(comparing_Russia_Murder.index, comparing_Russia_Murder.values,'o--', color='#63B00C', alpha=0.5)
plt.grid(axis = 'y', linestyle=':', alpha=1,color = 'black')
title_size = 18
plt.title("Russia Murder Rate" ,fontsize=title_size)
plt.legend(loc="upper right",fontsize= 15)
plt.ylabel("Rate",fontsize=title_size)
plt.xlabel("Years", fontsize=title_size)
plt.tick_params(labelsize=16,length=0)
plt.tight_layout()
plt.show()
Average_Russia_Murder = (210.41 + 193.93 + 136.59 + 124.24)/ 4
Average_Russia_Murder
166.29250000000002
murder_ratio.Russia.describe()
count 27.000000 mean 168.081397 std 38.555582 min 108.085106 25% 126.653232 50% 175.471698 75% 203.425224 max 223.478261 Name: Russia, dtype: float64
comparing_Afghanistan_Murder = Comparing(murder_ratio.Afghanistan)
plt.figure(figsize=(15,10), dpi= 65)
plt.vlines(x=comparing_Afghanistan_Murder.index, ymin=0, ymax=comparing_Afghanistan_Murder.values,label='Afghanistan',color="#36110A")
for x, y in zip(comparing_Afghanistan_Murder.index, comparing_Afghanistan_Murder.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#c91a22' if y > 17.26 else '#098003', 'size':14})
plt.plot(comparing_Afghanistan_Murder.index, comparing_Afghanistan_Murder.values,'o--', color='#6B1F15', alpha=0.5)
plt.grid(axis = 'y', linestyle=':', alpha=1,color = 'black')
title_size = 18
plt.title("Afghanistan Murder Rate" ,fontsize=title_size)
plt.legend(loc="upper right",fontsize= 15)
plt.ylabel("Rate",fontsize=title_size)
plt.xlabel("Years", fontsize=title_size)
plt.tick_params(labelsize=16,length=0)
plt.tight_layout()
plt.show()
Average_Afghanistan_Murder = (17.26 + 18.48 + 16.92 + 17.71)/ 4
Average_Afghanistan_Murder
17.5925
murder_ratio.Afghanistan.describe()
count 27.000000 mean 17.288615 std 0.661903 min 16.413793 25% 16.689316 50% 17.213622 75% 17.683366 max 18.502024 Name: Afghanistan, dtype: float64
comparing_USA_Murder = Comparing(murder_ratio["United States"])
plt.figure(figsize=(15,10), dpi= 65)
plt.vlines(x=comparing_USA_Murder.index, ymin=0, ymax=comparing_USA_Murder.values,label='United States',color="#36110A")
for x, y in zip(comparing_USA_Murder.index, comparing_USA_Murder.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#c91a22' if y > 60 else '#098003', 'size':14})
plt.plot(comparing_USA_Murder.index, comparing_USA_Murder.values,'o--', color='#6B1F15', alpha=0.5)
plt.grid(axis = 'y', linestyle=':', alpha=1,color = 'black')
title_size = 18
plt.title("United States Murder Rate" ,fontsize=title_size)
plt.legend(loc="upper right",fontsize= 15)
plt.ylabel("Rate",fontsize=title_size)
plt.xlabel("Years", fontsize=title_size)
plt.tick_params(labelsize=16,length=0)
plt.tight_layout()
plt.show()
Average_USA_Murder = (76.79 + 67.15 + 54.01 + 46.21)/ 4
Average_USA_Murder
61.04
murder_ratio["United States"].describe()
count 27.000000 mean 76.649519 std 25.549383 min 46.212121 25% 55.350122 50% 71.153846 75% 92.327189 max 128.160920 Name: United States, dtype: float64
comparing_China_Murder = Comparing(murder_ratio.China)
plt.figure(figsize=(15,10), dpi= 65)
plt.vlines(x=comparing_China_Murder.index, ymin=0, ymax=comparing_China_Murder.values,label='China',color="#36110A")
for x, y in zip(comparing_China_Murder.index, comparing_China_Murder.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#c91a22' if y > 150 else '#098003', 'size':14})
plt.plot(comparing_China_Murder.index, comparing_China_Murder.values,'o--', color='#6B1F15', alpha=0.5)
plt.grid(axis = 'y', linestyle=':', alpha=1,color = 'black')
title_size = 18
plt.title("China Murder Rate" ,fontsize=title_size)
plt.legend(loc="upper right",fontsize= 15)
plt.ylabel("Rate",fontsize=title_size)
plt.xlabel("Years", fontsize=title_size)
plt.tick_params(labelsize=16,length=0)
plt.tight_layout()
plt.show()
Average_China_Murder = (283.23 + 177.4 + 115.27 + 78.24)/ 4
Average_China_Murder
163.535
murder_ratio.China.describe()
count 27.000000 mean 229.156154 std 115.507716 min 78.242678 25% 120.514256 50% 213.095238 75% 352.682318 max 392.372881 Name: China, dtype: float64
df_Murder.set_index("country", inplace = True)
df_Murder = df_Murder.T
df_Murder.columns.rename(name="Years",inplace=True)
murder = {}
for country in df_Murder.columns:
murder[df_Murder[country].mean()] = country
print("The country with the most Murder Rate is {} with an average of --> {} ....".format(murder[max(murder.keys())],max(murder.keys())))
The country with the most Murder Rate is Brazil with an average of --> 52555.555555555555 ....
print("The country with the Least Murder Rate is {} with an average of --> {} ....".format(murder[min(murder.keys())],min(murder.keys())))
The country with the Least Murder Rate is Andorra with an average of --> 0.5137037037037038 ....
comparing = df_Population[(df_Population.index == "2000") | (df_Population.index == "2005") | (df_Population.index == "2010") | (df_Population.index == "2016")]
fig,ax = plt.subplots(figsize=(15,10),dpi=70)
splot = sns.barplot(x=ye2,y=comparing.Egypt,data=comparing,ci=95,ax=ax,palette = "viridis")
for p in splot.patches:
if p.get_height() > 0: # -- > i used if statments bcz when i try to use annotators , there is some countries that have negative values , so the position of the value gets in the bar..
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 : # --> i had to seperate the positive values from the negative values and give each ot them a different axis...
splot.annotate(format(p.get_height(), ".1f"),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11), # ---> Negative y axis since its a negative value ...
textcoords = 'offset points')
for patch in ax.patches :
current_width = patch.get_width()
diff = current_width - 0.1
# we change the bar width
patch.set_width(.1)
# we recenter the bar
patch.set_x(patch.get_x() + diff * .5)
title_size = 18
ax.set_title("Egypt Population" ,fontsize=title_size)
ax.set_ylabel("Count",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
Egyption_Population = 94400000 - 68800000
Egyption_Population
25600000
comparing.Egypt.describe()
count 4.000000e+00 mean 8.037500e+07 std 1.095943e+07 min 6.880000e+07 25% 7.382500e+07 50% 7.915000e+07 75% 8.570000e+07 max 9.440000e+07 Name: Egypt, dtype: float64
fig,ax = plt.subplots(figsize=(15,10),dpi=70)
splot = sns.barplot(x=ye2,y=comparing.Russia,data=df_Population,ci=95,ax=ax,palette = "mako")
for p in splot.patches:
if p.get_height() > 0: # -- > i used if statments bcz when i try to use annotators , there is some countries that have negative values , so the position of the value gets in the bar..
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 : # --> i had to seperate the positive values from the negative values and give each ot them a different axis...
splot.annotate(format(p.get_height(), ".1f"),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11), # ---> Negative y axis since its a negative value ...
textcoords = 'offset points')
for patch in ax.patches :
current_width = patch.get_width()
diff = current_width - 0.1
# we change the bar width
patch.set_width(.1)
# we recenter the bar
patch.set_x(patch.get_x() + diff * .5)
title_size = 18
ax.set_title("Russia Population" ,fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
Russia_Population = 14600000 - 14500000
Russia_Population
100000
comparing.Russia.describe()
count 4.000000e+00 mean 1.445000e+08 std 1.290994e+06 min 1.430000e+08 25% 1.437500e+08 50% 1.445000e+08 75% 1.452500e+08 max 1.460000e+08 Name: Russia, dtype: float64
fig,ax = plt.subplots(figsize=(15,10),dpi=70)
splot = sns.barplot(x=ye2,y=comparing.China,data=df_Population,ci=95,ax=ax,palette = "cubehelix")
for p in splot.patches:
if p.get_height() > 0: # -- > i used if statments bcz when i try to use annotators , there is some countries that have negative values , so the position of the value gets in the bar..
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 : # --> i had to seperate the positive values from the negative values and give each ot them a different axis...
splot.annotate(format(p.get_height(), ".1f"),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11), # ---> Negative y axis since its a negative value ...
textcoords = 'offset points')
for patch in ax.patches :
current_width = patch.get_width()
diff = current_width - 0.1
# we change the bar width
patch.set_width(.1)
# we recenter the bar
patch.set_x(patch.get_x() + diff * .5)
title_size = 18
ax.set_title("China Population" ,fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
China_Population = 1410000000 - 1290000000
China_Population
120000000
comparing.China.describe()
count 4.000000e+00 mean 1.350000e+09 std 5.163978e+07 min 1.290000e+09 25% 1.320000e+09 50% 1.350000e+09 75% 1.380000e+09 max 1.410000e+09 Name: China, dtype: float64
fig,ax = plt.subplots(figsize=(15,10),dpi=70)
splot = sns.barplot(x=ye2,y=comparing.Japan,data=df_Population,ci=95,ax=ax,palette = "rocket_r")
for p in splot.patches:
if p.get_height() > 0: # -- > i used if statments bcz when i try to use annotators , there is some countries that have negative values , so the position of the value gets in the bar..
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 : # --> i had to seperate the positive values from the negative values and give each ot them a different axis...
splot.annotate(format(p.get_height(), ".1f"),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11), # ---> Negative y axis since its a negative value ...
textcoords = 'offset points')
for patch in ax.patches :
current_width = patch.get_width()
diff = current_width - 0.1
# we change the bar width
patch.set_width(.1)
# we recenter the bar
patch.set_x(patch.get_x() + diff * .5)
title_size = 18
ax.set_title("Japan Population" ,fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
Japan_Population = 129000000 - 128000000
Japan_Population
1000000
comparing.Japan.describe()
count 4.0 mean 128250000.0 std 500000.0 min 128000000.0 25% 128000000.0 50% 128000000.0 75% 128250000.0 max 129000000.0 Name: Japan, dtype: float64
fig,ax = plt.subplots(figsize=(15,10),dpi=70)
splot = sns.barplot(x=ye2,y=comparing["United States"],data=df_Population,ci=95,ax=ax,palette = "RdYlGn")
for p in splot.patches:
if p.get_height() > 0: # -- > i used if statments bcz when i try to use annotators , there is some countries that have negative values , so the position of the value gets in the bar..
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 : # --> i had to seperate the positive values from the negative values and give each ot them a different axis...
splot.annotate(format(p.get_height(), ".1f"),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11), # ---> Negative y axis since its a negative value ...
textcoords = 'offset points')
for patch in ax.patches :
current_width = patch.get_width()
diff = current_width - 0.1
# we change the bar width
patch.set_width(.1)
# we recenter the bar
patch.set_x(patch.get_x() + diff * .5)
title_size = 18
ax.set_title("United States Population" ,fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
USA_Population = 323000000 - 282000000
USA_Population
41000000
comparing["United States"].describe()
count 4.000000e+00 mean 3.022500e+08 std 1.768945e+07 min 2.820000e+08 25% 2.917500e+08 50% 3.020000e+08 75% 3.125000e+08 max 3.230000e+08 Name: United States, dtype: float64
comparing_Afghanistan_Population.values
array([20800000., 25700000., 29200000., 35400000.])
fig,ax = plt.subplots(figsize=(15,10),dpi=70)
comparing_Afghanistan_Population = Comparing(df_Population.Afghanistan)
splot = sns.barplot(x=ye2,y=comparing_Afghanistan_Population,data=df_Population,ci=95,ax=ax,palette = "magma")
for p in splot.patches:
if p.get_height() > 0: # -- > i used if statments bcz when i try to use annotators , there is some countries that have negative values , so the position of the value gets in the bar..
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 : # --> i had to seperate the positive values from the negative values and give each ot them a different axis...
splot.annotate(format(p.get_height(), ".1f"),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11), # ---> Negative y axis since its a negative value ...
textcoords = 'offset points')
for patch in ax.patches :
current_width = patch.get_width()
diff = current_width - 0.1
# we change the bar width
patch.set_width(.1)
# we recenter the bar
patch.set_x(patch.get_x() + diff * .5)
title_size = 18
ax.set_title("Afghanistan Population" ,fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
Afghanistan_Population = 354000000 - 208000000
Afghanistan_Population
146000000
comparing.Afghanistan.describe()
count 4.000000e+00 mean 2.777500e+07 std 6.140779e+06 min 2.080000e+07 25% 2.447500e+07 50% 2.745000e+07 75% 3.075000e+07 max 3.540000e+07 Name: Afghanistan, dtype: float64
population = {}
for country in df_Population.columns:
population[df_Population[country].mean()] = country
print("The country with the most Population Rate is {} with an average of --> {} ....".format(population[max(population.keys())],max(population.keys())))
The country with the most Population Rate is China with an average of --> 1308888888.8888888 ....
print("The country with the most Population Rate is {} with an average of --> {} ....".format(population[min(population.keys())],min(population.keys())))
The country with the most Population Rate is Holy See with an average of --> 785.5925925925926 ....
plt.style.use('seaborn-dark')
comparing_Egypt_GDP = Comparing(df_GDP.Egypt)
comparing_Russia_GDP = Comparing(df_GDP.Russia)
comparing_China_GDP = Comparing(df_GDP.China)
comparing_Afghanistan_GDP = Comparing(df_GDP.Afghanistan)
comparing_Japan_GDP = Comparing(df_GDP.Japan)
comparing_USA_GDP = Comparing(df_GDP["United States"])
fig, ax = plt.subplots(figsize = (15,10),dpi=65)
a = ax.plot(comparing_Egypt_GDP.index, comparing_Egypt_GDP.values, 'o-',color='#7f6d5f', label='Egypt')
ax.plot(comparing_China_GDP.index, comparing_China_GDP.values, 'o-', color='#557f2d', label='China')
ax.plot(comparing_Russia_GDP.index, comparing_Russia_GDP.values,'D-',color='#2d7f5e',label='Russia')
ax.plot(comparing_Japan_GDP.index, comparing_Japan_GDP.values, 'o-',color='#120603',label='Japan')
ax.plot(comparing_Afghanistan_GDP.index, comparing_Afghanistan_GDP.values, 'o-',color='#c912c6',label='Afghanistan')
ax.plot(comparing_USA_GDP.index, comparing_USA_GDP.values, 'o-',color='#DE5833',label='United States')
ax.set_title('GDP Growth for group of countries')
ax.set_xlabel('Years')
ax.set_ylabel('Ratio')
plt.legend()
plt.grid(axis = 'x', linestyle=':', alpha=1,color = 'black')
plt.grid(axis = 'y', linestyle=':', alpha=1,color = 'black')
plt.tight_layout()
plt.show()
fig,ax = plt.subplots(figsize=(10,7),dpi=65)
splot = sns.barplot(x=comparing_Egypt_GDP.index,y=comparing_Egypt_GDP.values,data=df_GDP,ci=95,ax=ax,palette = "viridis")
for p in splot.patches:
if p.get_height() > 0: # -- > i used if statments bcz when i try to use annotators , there is some countries that have negative values , so the position of the value gets in the bar..
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 : # --> i had to seperate the positive values from the negative values and give each ot them a different axis...
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11), # ---> Negative y axis since its a negative value ...
textcoords = 'offset points')
title_size = 18
ax.set_title("Egypt GDP Growth Rate" ,fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
df_GDP.Egypt.describe()
count 27.000000 mean 4.357928 std 1.650896 min 1.125405 25% 3.054683 50% 4.471744 75% 5.533926 max 7.156284 Name: Egypt, dtype: float64
fig,ax = plt.subplots(figsize=(10,7),dpi=65)
splot = sns.barplot(x=comparing_Russia_GDP.index,y=comparing_Russia_GDP.values,data=df_GDP,ci=95,ax=ax,palette = "mako")
for p in splot.patches:
if p.get_height() > 0: # -- > i used if statments bcz when i try to use annotators , there is some countries that have negative values , so the position of the value gets in the bar..
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 : # --> i had to seperate the positive values from the negative values and give each ot them a different axis...
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11), # ---> Negative y axis since its a negative value ...
textcoords = 'offset points')
ax.set_title("Russia GDP Growth Rate",fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.grid(axis = 'y', linestyle=':', alpha=1,color = 'black')
plt.tight_layout()
df_GDP.Russia.describe()
count 27.000000 mean 0.708213 std 6.655096 min -14.531074 25% -3.949299 50% 1.755422 75% 5.799942 max 10.000067 Name: Russia, dtype: float64
fig,ax = plt.subplots(figsize=(10,7),dpi=65)
splot = sns.barplot(x=comparing_USA_GDP.index,y=comparing_USA_GDP.values,data=df_GDP,ci=95,ax=ax,palette = "RdYlGn")
for p in splot.patches:
if p.get_height() > 0:
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 :
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11),
textcoords = 'offset points')
ax.set_title("United States GDP Growth Rate",fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
df_GDP["United States"].describe()
count 27.000000 mean 2.473026 std 1.620977 min -2.536757 25% 1.791888 50% 2.684217 75% 3.647503 max 4.753236 Name: United States, dtype: float64
fig,ax = plt.subplots(figsize=(10,7),dpi=65)
splot = sns.barplot(x=comparing_Afghanistan_GDP.index,y=comparing_Afghanistan_GDP.values,data=df_GDP,ci=95,ax=ax,palette = "viridis")
for p in splot.patches:
if p.get_height() > 0:
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 :
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11),
textcoords = 'offset points')
ax.set_title("Afghanistan GDP Growth Rate",fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
df_GDP.Afghanistan.describe()
count 27.000000 mean 3.909383 std 5.888010 min 0.000000 25% 0.000000 50% 0.426355 75% 5.479074 max 21.390528 Name: Afghanistan, dtype: float64
fig,ax = plt.subplots(figsize=(10,7),dpi=65)
splot = sns.barplot(x=comparing_China_GDP.index,y=comparing_China_GDP.values,data=df_GDP,ci=95,ax=ax,palette = "cubehelix")
for p in splot.patches:
if p.get_height() > 0:
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 :
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11),
textcoords = 'offset points')
ax.set_title("China GDP Growth Rate",fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
df_GDP.China.describe()
count 27.000000 mean 9.651421 std 2.457343 min 3.920251 25% 7.854844 50% 9.398726 75% 10.794913 max 14.230861 Name: China, dtype: float64
fig,ax = plt.subplots(figsize=(10,7),dpi=65)
splot = sns.barplot(x=comparing_Japan_GDP.index,y=comparing_Japan_GDP.values,data=df_GDP,ci=95,ax=ax,palette = "rocket_r")
for p in splot.patches:
if p.get_height() > 0:
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, 9),
textcoords = 'offset points')
if p.get_height() < 0 :
splot.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
size=15,
xytext = (0, -11),
textcoords = 'offset points')
ax.set_title("Japan GDP Growth Rate",fontsize=title_size)
ax.set_ylabel("Ratio",fontsize=title_size)
ax.tick_params(labelsize=16,length=0)
plt.tight_layout()
df_GDP.Japan.describe()
count 27.000000 mean 1.094228 std 2.025525 min -5.693236 25% 0.169084 50% 1.372350 75% 2.095608 max 4.892713 Name: Japan, dtype: float64
economy = {}
for country in df_GDP.columns[1:]:
economy[df_GDP[country].mean()] = country
print("The country with the most economy Growth is {} with an average of --> {} ....".format(economy[max(economy.keys())],max(economy.keys())))
The country with the most economy Growth is Equatorial Guinea with an average of --> 19.974110408814813 ....
print("The country with the least Growth is {} with an average of --> {} ....".format(economy[min(economy.keys())],min(economy.keys())))
The country with the least Growth is Ukraine with an average of --> -1.8408876753703698 ....
plt.figure(figsize=(15,10),dpi= 65)
comparing_Egypt_Income = Comparing(df_Income.Egypt)
comparing_Russia_Income = Comparing(df_Income.Russia)
comparing_China_Income = Comparing(df_Income.China)
comparing_Afghanistan_Income = Comparing(df_Income.Afghanistan)
comparing_Japan_Income = Comparing(df_Income.Japan)
comparing_USA_Income = Comparing(df_Income["United States"])
plt.step(comparing_Egypt_Income.index, comparing_Egypt_Income.values, label='Egypt')
plt.plot(comparing_Egypt_Income.index, comparing_Egypt_Income.values, 'o--', color='blue', alpha=0.3)
for x, y in zip(comparing_Egypt_Income.index, comparing_Egypt_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#1E5A6A', 'size':14})
plt.step(comparing_Russia_Income.index, comparing_Russia_Income.values, label='Russia')
plt.plot(comparing_Russia_Income.index, comparing_Russia_Income.values, 'o--', color='#a1a30b', alpha=0.3)
for x, y in zip(comparing_Russia_Income.index, comparing_Russia_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#7d870e', 'size':14})
plt.step(comparing_China_Income.index, comparing_China_Income.values, label='China')
plt.plot(comparing_China_Income.index, comparing_China_Income.values, 'o--', color='green', alpha=0.3)
for x, y in zip(comparing_China_Income.index, comparing_China_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#18540C', 'size':14})
plt.step(comparing_Japan_Income.index, comparing_Japan_Income.values, label='Japan')
plt.plot(comparing_Japan_Income.index, comparing_Japan_Income.values, 'o--', color='red', alpha=0.3)
for x, y in zip(comparing_Japan_Income.index, comparing_Japan_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#940025', 'size':14})
plt.step(comparing_Afghanistan_Income.index, comparing_Afghanistan_Income.values, label='Afghanistan')
plt.plot(comparing_Afghanistan_Income.index, comparing_Afghanistan_Income.values, 'o--', color='purple', alpha=0.3)
for x, y in zip(comparing_Afghanistan_Income.index, comparing_Afghanistan_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#96005d', 'size':14})
plt.step(comparing_USA_Income.index, comparing_USA_Income.values, label='United States')
plt.plot(comparing_USA_Income.index, comparing_USA_Income.values, 'o--', color='grey', alpha=0.3)
for x, y in zip(comparing_USA_Income.index, comparing_USA_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#474747', 'size':14})
plt.title('Countries income Growth..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Income")
plt.grid(axis = 'y', linestyle=':', alpha=1,color = 'black')
plt.legend(fontsize = 14 , loc = "center left")
plt.tight_layout()
plt.show()
plt.figure(figsize=(15,10),dpi= 65)
plt.step(comparing_Egypt_Income.index, comparing_Egypt_Income.values, label='Egypt')
plt.plot(comparing_Egypt_Income.index, comparing_Egypt_Income.values, 'o--', color='blue', alpha=0.3)
for x, y in zip(comparing_Egypt_Income.index, comparing_Egypt_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#065266', 'size':14})
plt.title('Egypt income Growth..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Income")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = 'blue')
plt.legend(loc = "upper left", fontsize = 14)
plt.tight_layout()
plt.show()
df_Income.Egypt.describe()
count 27.00000 mean 8309.62963 std 1664.35823 min 6020.00000 25% 6785.00000 50% 8010.00000 75% 10150.00000 max 10800.00000 Name: Egypt, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.step(comparing_Russia_Income.index, comparing_Russia_Income.values, label='Russia', color = "#7d870e")
plt.plot(comparing_Russia_Income.index, comparing_Russia_Income.values, 'o--', color='#7d870e', alpha=0.3)
for x, y in zip(comparing_Russia_Income.index, comparing_Russia_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#596100', 'size':14})
plt.title('Russia income Growth..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Income")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = '#596100')
plt.legend(loc = "upper left", fontsize = 14)
plt.tight_layout()
plt.show()
df_Income.Russia.describe()
count 27.000000 mean 19585.185185 std 4987.422928 min 12400.000000 25% 15000.000000 50% 20100.000000 75% 24500.000000 max 26400.000000 Name: Russia, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.step(comparing_China_Income.index, comparing_China_Income.values, label='China', color = "#18540C")
plt.plot(comparing_China_Income.index, comparing_China_Income.values, 'o--', color='green', alpha=0.3)
for x, y in zip(comparing_China_Income.index, comparing_China_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#18540C', 'size':14})
plt.title('China income Growth..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Income")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = '#18540C')
plt.legend(loc = "upper left", fontsize = 14)
plt.tight_layout()
plt.show()
df_Income.China.describe()
count 27.000000 mean 5744.814815 std 3778.361845 min 1420.000000 25% 2705.000000 50% 4400.000000 75% 8480.000000 max 13500.000000 Name: China, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.step(comparing_Japan_Income.index, comparing_Japan_Income.values, label='Japan',color="#940025")
plt.plot(comparing_Japan_Income.index, comparing_Japan_Income.values, 'o--', color='red', alpha=0.3)
for x, y in zip(comparing_Japan_Income.index, comparing_Japan_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#940025', 'size':14})
plt.title('Japan income Growth..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Income")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = '#940025')
plt.legend(loc = "upper left", fontsize = 14)
plt.tight_layout()
plt.show()
df_Income.Japan.describe()
count 27.000000 mean 36377.777778 std 2249.672341 min 32300.000000 25% 34900.000000 50% 36200.000000 75% 38200.000000 max 40200.000000 Name: Japan, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.step(comparing_USA_Income.index, comparing_USA_Income.values, label='United States',color="#474747")
plt.plot(comparing_USA_Income.index, comparing_USA_Income.values, 'o--', color='grey', alpha=0.3)
for x, y in zip(comparing_USA_Income.index, comparing_USA_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#474747', 'size':14})
plt.title('United States income Growth..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Income")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = '#474747')
plt.legend(loc = "upper left", fontsize = 14)
plt.tight_layout()
plt.show()
df_Income["United States"].describe()
count 27.000000 mean 50333.333333 std 6139.218191 min 39900.000000 25% 44850.000000 50% 51600.000000 75% 55350.000000 max 59000.000000 Name: United States, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.step(comparing_Afghanistan_Income.index, comparing_Afghanistan_Income.values, label='Afghanistan',color = '#96005d')
plt.plot(comparing_Afghanistan_Income.index, comparing_Afghanistan_Income.values, 'o--', color='purple', alpha=0.3)
for x, y in zip(comparing_Afghanistan_Income.index, comparing_Afghanistan_Income.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#96005d', 'size':14})
plt.title('Afghanistan income Growth..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Income")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = '#96005d')
plt.legend(loc = "upper left", fontsize = 14)
plt.tight_layout()
plt.show()
df_Income.Afghanistan.describe()
count 27.000000 mean 1256.592593 std 573.533331 min 493.000000 25% 677.500000 50% 1200.000000 75% 1835.000000 max 2120.000000 Name: Afghanistan, dtype: float64
Income = {}
for country in df_Income.columns[1:]:
Income[df_Income[country].mean()] = country
print("The country with the most Income Rate is {} with an average of --> ${} ....".format(Income[max(Income.keys())],max(Income.keys())))
The country with the most Income Rate is Luxembourg with an average of --> $95451.85185185185 ....
print("The country with the least Income Rate is {} with an average of --> ${} ....".format(Income[min(Income.keys())],min(Income.keys())))
The country with the least Income Rate is Somalia with an average of --> $732.1481481481482 ....
plt.figure(figsize=(15,10),dpi= 65)
comparing_Egypt_Unemployment = Comparing(df_Unemployment.Egypt)
comparing_Russia_Unemployment = Comparing(df_Unemployment.Russia)
comparing_China_Unemployment = Comparing(df_Unemployment.China)
comparing_Afghanistan_Unemployment = Comparing(df_Unemployment.Afghanistan)
comparing_Japan_Unemployment = Comparing(df_Unemployment.Japan)
comparing_USA_Unemployment = Comparing(df_Unemployment["United States"])
plt.plot(comparing_Egypt_Unemployment.index,comparing_Egypt_Unemployment.values,'->',markerfacecolor = "yellow", label='Egypt')
for x, y in zip(comparing_Egypt_Unemployment.index, comparing_Egypt_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#065266', 'size':14})
plt.plot(comparing_Russia_Unemployment.index,comparing_Russia_Unemployment.values,'-*',markerfacecolor = "green" ,label='Russia')
for x, y in zip(comparing_Russia_Unemployment.index, comparing_Russia_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#596100', 'size':14})
plt.plot(comparing_China_Unemployment.index,comparing_China_Unemployment.values,'-o',markerfacecolor = "red", label='China')
for x, y in zip(comparing_China_Unemployment.index, comparing_China_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#18540C', 'size':14})
plt.plot(comparing_Afghanistan_Unemployment.index,comparing_Afghanistan_Unemployment.values,'-^',markerfacecolor = "blue" , label='Afghanistan')
for x, y in zip(comparing_Afghanistan_Unemployment.index, comparing_Afghanistan_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#96005d', 'size':14})
plt.plot(comparing_USA_Unemployment.index,comparing_USA_Unemployment.values,'-x',markerfacecolor = "purple" , label='United States')
for x, y in zip(comparing_USA_Unemployment.index, comparing_USA_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#474747', 'size':14})
plt.plot(comparing_Japan_Unemployment.index,comparing_Japan_Unemployment.values,'-2',markerfacecolor = "gray", label='Japan')
for x, y in zip(comparing_Japan_Unemployment.index, comparing_Japan_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#940025', 'size':14})
plt.title('Countries Unemployment rate..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Unemployment rate")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = '#96005d')
plt.legend(fontsize=14)
plt.tight_layout()
plt.figure(figsize=(15,10),dpi= 65)
plt.plot(comparing_Egypt_Unemployment.index, comparing_Egypt_Unemployment.values,'->',markerfacecolor = "yellow", label='Egypt')
for x, y in zip(comparing_Egypt_Unemployment.index, comparing_Egypt_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#065266', 'size':14})
plt.title('Egypt Unemployment Rate..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Unemployment rate")
plt.legend(fontsize=14,loc= "upper left")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = 'blue')
plt.tight_layout()
plt.show()
df_Unemployment.Egypt.describe()
count 27.000000 mean 9.894074 std 2.564502 min 0.000000 25% 8.860000 50% 10.010000 75% 11.120000 max 13.150000 Name: Egypt, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.plot(comparing_Russia_Unemployment.index, comparing_Russia_Unemployment.values,'-*',color = "green",markerfacecolor = "yellow" ,label='Russia')
for x, y in zip(comparing_Russia_Unemployment.index, comparing_Russia_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#065266', 'size':14})
plt.title('Russia Unemployment Rate..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Unemployment rate")
plt.legend(fontsize=14,loc= "upper right")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = 'green')
plt.tight_layout()
plt.show()
df_Unemployment["Russia"].describe()
count 27.000000 mean 7.445370 std 2.770113 min 0.000000 25% 5.565000 50% 7.120000 75% 8.640000 max 13.260000 Name: Russia, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.plot(comparing_China_Unemployment.index, comparing_China_Unemployment.values,'-o',color = "red",markerfacecolor = "yellow", label='China')
for x, y in zip(comparing_China_Unemployment.index, comparing_China_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#18540C', 'size':14})
plt.title('China Unemployment Rate..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Unemployment rate")
plt.legend(fontsize=14,loc= "upper left")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = 'red')
plt.tight_layout()
plt.show()
df_Unemployment["China"].describe()
count 27.000000 mean 3.746667 std 1.091696 min 0.000000 25% 3.175000 50% 4.350000 75% 4.560000 max 4.720000 Name: China, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.plot(comparing_Afghanistan_Unemployment.index, comparing_Afghanistan_Unemployment.values,'-^',color = "black",markerfacecolor = "red" , label='Afghanistan')
for x, y in zip(comparing_Afghanistan_Unemployment.index, comparing_Afghanistan_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#96005d', 'size':14})
plt.title('Afghanistan Unemployment Rate..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Unemployment rate")
plt.legend(fontsize=14,loc= "upper left")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = 'black')
plt.tight_layout()
plt.show()
df_Unemployment["Afghanistan"].describe()
count 27.000000 mean 10.623815 std 2.133948 min 0.000000 25% 10.807500 50% 11.093000 75% 11.186000 max 11.352000 Name: Afghanistan, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.plot(comparing_USA_Unemployment.index, comparing_USA_Unemployment.values,'-x',color = "purple",markerfacecolor = "purple" , label='United States')
for x, y in zip(comparing_USA_Unemployment.index, comparing_USA_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#474747', 'size':14})
plt.title('United States Unemployment Rate..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Unemployment rate")
plt.legend(fontsize=14,loc= "upper left")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = 'purple')
plt.tight_layout()
plt.show()
df_Unemployment["United States"].describe()
count 27.000000 mean 5.846667 std 1.930992 min 0.000000 25% 4.800000 50% 5.650000 75% 6.850000 max 9.630000 Name: United States, dtype: float64
plt.figure(figsize=(15,10),dpi= 65)
plt.plot(comparing_Japan_Unemployment.index, comparing_Japan_Unemployment.values,'-2',color = "#0e786c",markerfacecolor = "gray", label='Japan')
for x, y in zip(comparing_Japan_Unemployment.index, comparing_Japan_Unemployment.values):
t = plt.text(x, y,round(y, 2), verticalalignment='top' if y < 0 else 'bottom',
fontdict={'color':'#940025', 'size':14})
plt.title('Japan Unemployment Rate..',fontsize=15)
plt.xlabel("Years")
plt.ylabel("Unemployment rate")
plt.legend(fontsize=14,loc= "upper left")
plt.grid(axis = 'x', linestyle='dashdot', alpha=1,color = '#0e786c')
plt.tight_layout()
plt.show()
df_Unemployment["Japan"].describe()
count 27.000000 mean 3.827778 std 1.198834 min 0.000000 25% 3.300000 50% 4.000000 75% 4.715000 max 5.390000 Name: Japan, dtype: float64
Unemployment = {}
for country in df_Unemployment.columns:
Unemployment[df_Unemployment[country].mean()] = country
print("The country with the most Unemployment rate is {} with an average of --> {} ....".format(Unemployment[max(Unemployment.keys())],max(Unemployment.keys())))
The country with the most Unemployment rate is North Macedonia with an average of --> 30.729629517037043 ....
print("The country with the least Unemployment Rate is {} with an average of --> {} ....".format(Unemployment[min(Unemployment.keys())],min(Unemployment.keys())))
The country with the least Unemployment Rate is Kosovo with an average of --> 0.0 ....
macdonia_Unemployment = df_Unemployment["North Macedonia"]
macdonia_Unemployment.mean()
30.729629517037043
macdonia_Murder = murder_ratio["North Macedonia"]
macdonia_Murder.mean()
103.1156044669988
plt.figure(figsize=(15,10), dpi= 65)
sns.histplot(macdonia_Murder.values, color="dodgerblue", label="Murder", kde=True,stat="density", linewidth=0.5)
sns.histplot(macdonia_Unemployment.values, color="orange", label="Unemployment", kde=True,stat="density", linewidth=0.5)
# Decoration
plt.title('North Macedonia', fontsize=15)
plt.ylabel("")
plt.legend()
plt.show()
income_Luxembourg = df_Income.Luxembourg
income_Luxembourg.mean()
95451.85185185185
murder_Luxembourg = df_Murder.Luxembourg
murder_Luxembourg.mean()
6.7059259259259285
# Plot
fig, ax = plt.subplots(figsize=(15,10), dpi= 65)
sns.stripplot(x=murder_Luxembourg, y= income_Luxembourg, jitter=0.25, size=8, ax=ax, linewidth=.5)
# Decorations
plt.title('Luxembourg', fontsize=14)
plt.ylabel("Income", fontsize=14)
plt.xlabel("Murder Rate", fontsize=14)
plt.grid(axis = 'y', linestyle='dashdot', alpha=0.2,color = '#0e786c')
plt.show()
Population_China = df_Population.China
Population_China.mean()
1308888888.8888888
Unemployment_China = df_Unemployment.China
Unemployment_China.mean()
3.746666669925926
plt.figure(figsize=(14,16), dpi= 65)
plt.scatter(Unemployment_China, Population_China, s=450, alpha=.6)
for x, y, tex in zip(Unemployment_China, Population_China, Unemployment_China):
t = plt.text(x, y, round(tex, 1), horizontalalignment='center',
verticalalignment='center', fontdict={'color':'white'})
# Decorations
# Lighten borders
plt.gca().spines["top"].set_alpha(.3)
plt.gca().spines["bottom"].set_alpha(.3)
plt.gca().spines["right"].set_alpha(.3)
plt.gca().spines["left"].set_alpha(.3)
# plt.yticks(Unemployment_China.index)
plt.title('China', fontdict={'size':16})
plt.xlabel('Unemployment Rate',fontsize=16)
plt.ylabel("Population",fontsize=16)
plt.grid(linestyle='--', alpha=0.5)
# plt.xlim(-2.5, 2.5)
plt.show()
Murder_Brazil = df_Murder.Brazil
Murder_Brazil.mean()
52555.555555555555
GDP_Brazil = df_GDP.Brazil
GDP_Brazil.mean()
2.281282081444444
# Draw Plot
plt.figure(figsize=(15,10), dpi= 65)
plt.scatter(Murder_Brazil, GDP_Brazil, c=Murder_Brazil, cmap='plasma')
plt.colorbar()
plt.title('Brazil',fontsize=16)
plt.xlabel('Murder Rate',fontsize=16)
plt.ylabel('GDP Rate',fontsize=16)
plt.grid(alpha=0.5)
plt.show()
We have investigated 5 indicators Unemplyment rate , Crime rate , GDP growth rate , Income Rate , Population rate ..
We compared countries and seen who has the most and least value of all the 5 indicators ...
Which country has the most and least Murder rate?
The country with the most Murder Rate is Brazil with an average of --> 52555.555555555555 ....
The country with the Least Murder Rate is Andorra with an average of --> 0.5137037037037038 ....
Which is the most and least country in Population?
The country with the most Population Rate is China with an average of --> 1308888888.8888888 ....
The country with the most Population Rate is Holy See with an average of --> 785.5925925925926 ....
Which country has the most and least GDP Rate?
The country with the most economy Growth is Equatorial Guinea with an average of --> 19.974110408814813 ....
The country with the least Growth is Ukraine with an average of --> -1.8408876753703698 ....
Which country has the most and least Income Rate?
The country with the most Income Rate is Luxembourg with an average of --> \$95451.85185185185 ....
The country with the least Income Rate is Somalia with an average of --> \$732.1481481481482 ....
Which country has the most and least Unemployment Rate?
The country with the most Unemployment rate is North Macedonia with an average of --> 30.729629517037043 ....
The country with the least Unemployment Rate is Kosovo with an average of --> 0.0 ....
Does Unemployment rate have an effect on Murder rate ?
No, the increase in Unemployent doesnt effect the Murder rate
Does increase in Income rate will lead to decrease the Murder rate ?
Yes, Increasing the income rate will decrease the murder rate ..
Does the increase in Population effect the Unemployment Rate ?
Yes, Increasing in Population will increase the Unemployment rate ..
Does the increase in Murder rate effect the Economy?
No, Increasing in Murder rate doesnt Effect the Economy ..
There Was no nan limitaions since the years doesnt depend on each others .. So changing NaN Values to 0 didnt effect the analysis ..
But there was a limations in years , Beaceause Not all data have the same amount years , Like the Unemployment data and GDP data both start from 1950 , but for Population data it starts from 1850 , same for Income Data it starts from 1800, But Murder Data starts from 1990 to 2016 , So i had to drop all the other years during visualization and keep years from 1990 to 2016 ,Inorder to be able to Visualize datas Evenly then compare them to each other...